Villagers and Wandering Traders flee from any mobs that are naturally hostile towards them, such as zombies and illagers. However, other mobs, which are also hostile towards them, don’t cause this same reaction. This includes:
Withers - A Wither will attack Villagers and Wandering traders on sight, but they don’t flee from it, only momentarily once attacked. After a while without being attacked (due to the Wither missing some attacks), Villagers and Wandering Traders cease fleeing.
Wardens - Wardens attack anything that makes noise, as well as anything they sniff on. Other mobs don’t flee from the Warden, but most of these never run from anything anyway. For Villagers and Wandering Traders, though, this is inconsistent because they flee from anything that is naturally hostile towards them, which means that they should also flee from Wardens.
One could say that Villagers and Wandering Traders don’t flee from Withers and Wardens because they've never seen one before. However, the same could be said about Zoglins. Similar to Wardens and Withers, Zoglins attack pretty much anything on sight, including Villagers and Wandering Traders. Villagers and Wandering Traders wouldn’t usually meet a Zoglin, yet they still flee from it.
Environment
How to reproduce:
Start a new world in Creative mode;
Spawn a Villager or Wandering Trader next to a Wither;
Do the same test, but with a Warden;
For comparison purposes, do the same test with a Zoglin.
Expected results:
The Villager/Wandering Trader recognizes each of these mobs as a threat, fleeing from them.
Actual results:
They flee from Zoglins, but not from Withers and Wardens
This issue is technically reporting two different bugs. Since it's unlikely that Mojang would be able to fix villagers fleeing from both withers and wardens at the same time with a single code change, it would be preferred if this report were split.