When a zombie with spear targeting a thing, the spear may hurt other zombies and cause zombies attack each other, I don’t think this is feature, that’s so weird.
To reproduce:
1. Summon a zombie with spear/summon minecraft:zombie ~ ~ ~ {equipment:{mainhand:{id:iron_spear,count:1}}}
2. Summon more zombies on its front
3. Let them attacking you
Attachments
Comments 2

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.
Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.
Full Version History – Snapshot Version History – The official Minecraft feedback site
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki