The Bug
Zombies, Zombie Villagers, Pillagers, Ravangers, Vindicators, and Husks are all able to track a villager if aggression is engaged, and then from there the villager turns invisible.
Steps to Reproduce:
Spawn villager in a safe place
Spawn any of the listed mobs above
Allow the mob to become aggressive towards the villager
Turn the villager invisible
Observed Results:
Despite being invisible, the hostile mob will still be aggressive towards the villager.
Expected Results:
Since the villager is invisible and would not be tracked if it was invisible before aggression, it should be not be tageted once it has turned invisible.
Notes:
While this is similar to MC-79320, it is different as this is an issue with hostile mobs keeping aggression on invisible villagers rather than being aggressive towards invisible villagers no matter the context or when the zombie had aggression.
While MC-161468 is very similar, it only states this happens to wandering traders, and not villagers.
This issue also relates to MC-226362
This is the same with players...
Once a mob sees an entity and targets it, it'll know where it is, regardless of invisibility or not.
Touch a mob while invisible, and it'll haunt you as long as you're in range of it.