From my understanding,
setup happens the first time the meta data for the form is “loaded”. after that the meta data persists in memory and is not triggered again.
onload basically does the same thing, but for the actual document data. This is triggered just before the data is “loaded”. Subsequent reopens of the same document does not trigger this.
refresh can happen whenever the record rendered on the form is updated (eg. saving, submitting, opens) or when triggered manually.
onload_post_render is triggered when the actual document data has completed “loading”. This is always triggered after refresh whenever a form is opened or reopened.
The main difference between onload and onload_post_render is that former is run only the first time data is fetched from the server while the latter is triggered every time data is “loaded”.
I think referred to https://github.com/frappe/frappe/blob/master/frappe/public/js/legacy/form.js while I was trying to understand more about these.