The bug
When using a Piglin or Hoglin Spawn Egg in a non-Nether dimension to spawn a Piglin or Hoglin, their retreat sounds play instead of their ambient sounds. It does not affect other spawn eggs since their corresponding mobs do not even have retreat sounds.
I actually noticed this earlier, and it didn't happen before 1.16 Pre-release 6. Might have been caused by the various changes to mob sounds, but I think it's probably intentional.
And yes, piglins sounding scared in the overworld is intentional, but piglins didn't used to sound scared right when spawned with a spawn egg, so this is different.