This bug affects all hostile mobs.
1. universalAnger gamerule set to True
2. Drink the Invisibility Potion
3. change it to Survival mode
[Hit a mob while invisible. As you can see from the outcome, mobs will stay still when attacked by a player unless they get 3.5 close to the player]
This affects all mobs, including Iron Golems, Withers, and Ravagers, so if you drink the Invisibility Potion, you won't have a hard time catching them.
Duplicate of [MC-226532]. It's working as intended, mobs can attack invisible players at close range (3.5 blocks)