Everything that makes your character your character is stored on the Realm servers. Everything that makes your account your account is stored on a central system separate from both the log on servers and the realm servers.
The pets you own and those stuff belongs to your account, therefore they are stored on the same server that holds your account information. The realm server pulls information from the account server when generating which item exists.
Here is the tricky thing: Each server contains a physical instance of each item that was generated on that server. It is how they check for duplicates and the such. If gear is generated on a separate server then passed to your realm server, where do you check for injections? On the account server? Well during the "gap" between servers talking to each other it is possible to inject additional code that gives you a free item. Should we do it on the realm server then? The same problem happens. Maybe we can authenticate both? Authenticating one checks the other automatically so that does not matter.
Pets added to your account, mounts owned and account unlockables are stored on your user account as opposed to your realm account. This means when your realm account requests X item to be spawned, it can easily spawn that item. However when it comes to gear it is generated on that server and remains on that server. What this means is X sword of badassery is generated by the server and kept on the server. The account server does not care if you own X sword, but the other server does.
In simple terms: More then likely it is for security reasons. There are better ways to do it now but yeah that is my take on it.
An important thing to note is: Mounts, Pets, etc.... are not items. There is an item that allows you to unlock it for your account, but they are all spells, not physical items such as weapons and armor.
Heirloom weapons are actually actual items, not spells. Therefore it cannot be added to your account on the account servers because items only exist on the realm servers.