If a neutral mob is attacking you, quitting and rejoining the world will cause them to become neutral again. This includes at least Wolves, Endermen, Iron golems and Zombie Pigmen.
However, both Bees and Piglins are unaffected by this bug.
Attachments
Issue Links
is duplicated by
MC-8069Wolves are no longer hostile when attacked if the player has gone through nether portal but they show hostile texture
Resolved
MC-9415When you log out and back in, wolves stop being angry but still have red eyes
Resolved
MC-67943Neutral mobs (except PigZombies) forget aggression when Player logs out
Resolved
MC-90003Neutral mobs stop attacking after relogging