Ported mod Pet Teleport - Minecraft Mods - CurseForge
Pet Teleport adds a /pet command that teleports your tamed animals to you.
Your pets don't have to be nearby. The mod remembers where each one was last seen. So if your wolf is still at a base 5,000 blocks away, or you left your horse in the Nether, /pet briefly loads that spot and brings the pet back. If the pet isn't there anymore, you'll get a message saying so.
Usage
/pet brings all your pets
/pet <name>brings pets with that name tag
/pet <type> brings every pet of that typhorse, happy_ghast and so on
Tab completion only suggests the names and types of pets you own.
Happy ghasts
Happy ghasts can't be tamed the normal way, so the first player to ride one becomes its owner. After that, /pet finds it like any other pet. Happy ghasts only exist from 1.21.6 onward.
Permissions (Paper/Spigot)
petteleport.use lets a player use `/pet.