Heroes somehow drop gold at gates in home realms
When you summon heroes in home realms (both), there is a chance that a pile of gold will appear within the area of heroes gates. You can pick gold from the sacred earth piece before the gates, but you can't pick it from the gates, and workers can't pick it too. At first I thought it happens because miners get killed by defenses right after they spawned. But then I moved away all defenses, and never attacked heroes until they move far enough from the gates. And yet it still happens sometimes, right after summoning heroes a new pile of unobtainable gold appears at the gates. My guess is when the game creates heroes and gives them random amount of gold, it may exceed their capability to carry it, so they drop it.
i could reproduce the issue and i believe your idea why it happens is correct.
this does not happen on low level units but on higher level units commonly