When a player's game mode is changed to spectator, tamed mobs will continue to follow them for a while. The time it takes for them to stop seems to depend on the player's movement. If the player is standing still, all pets will stop following them within around 10 seconds, but if the player keeps moving, pets can continue to follow them indefinitely.
Relates to MC-46771.
Is this still an issue in the current Minecraft Snapshot 15w47c or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.