This may be a duplicate of MC-233607 . This ticket describes how hostile mobs will still track invisible players. This may also apply to iron golems that are in a hostile state.
You say“This may also apply to iron golems that are in a hostile state.”This isn't right,you can say”This may also apply to Neutral Creature that are in a hostile state.”,Although I mentioned only this creature, I have found that other neutral creatures hostile to players behave similarly.
This may be a duplicate of MC-233607 . This ticket describes how hostile mobs will still track invisible players. This may also apply to iron golems that are in a hostile state.