Under the guidance of Johnny Vindicator, the ravager and witch attack themselves
Very simple steps to reproduce:
/summon minecraft:vindicator ~ ~1 ~ {PatrolLeader:1b,Patrolling:1b,Johnny:1b}
summon a Ravager next to they
Observe the phenomenon. You should now see the Ravager starting to attack itself.
Replace the Ravager in the above process with a Witch, and you can observe the Witch attacking itself, but the witch will only use healing potions and regeneration potions when attacking herself.
It's haven't resolved and can confirm in 1.21.5