As I don't know where to find the "written" rules, I digged into the source code instead. Also note that there are both Vim and Neovim, but it looks that they still share almost the same code in this regard, so the following applies to both.
Also, let me remind that there is rtp-order and load-order, and they are different, as it'sit becomes clear from comparing the output of :set rtp? and :scriptnames.
So Vim does the following:
- Execute
:h --cmdif any - Source startup scripts (like
.vimrcand stuff). Note that.vimrcmay use:packloadalland such to force early plugins load - Save a copy of
&rtp - Add plugins directories to
&rtp(needed to make sure allautoload's are found). - Load standard plugins (i.e.
plugin/**/*.vimfrom saved&rtp, except forafter) - Load user plugins (i.e.
pack/*/start/*from&packpath!) - Source
after-plugins from new (current)&rtp
Now you ask about step (4) explicitly. On this step Vim finds every pack/*/start/* from &packpath and, if it's not yet in &rtp, adds it. The relevant code is in function named add_pack_dir_to_rtp() found in src/scriptfile.c (Vim) or src/ex_cmds2.c (Neovim).
As far as I understand, it simply takes the path prefix (before pack/... part) and tries to find the first match (like strncmp() with the length of the prefix) in the current &rtp and put it just after it. Hence all the user plugins paths normally go after ~/.vim but in reverse order (compared to their natural find-and-load-order). If no match was found they are added tothen the end ofitem is appended to &rtp (with respect to after).