Thank you for your post.
The OnRecordLoad triggers a script to run after going to a different record. It is a "post-event" trigger so the script doesn't execute until after the trigger action is completed. In this case, the click on the button and the button's action. The script is "queued" and will run after any previously queued scripts, but other button actions or user actions will be handled first. Therefore, if the button goes to a different layout, that action will be executed first before the OnRecordLoad script trigger executes. However, if the button calls a script, that script is queued as the OnRecordLoad script trigger then executes.