I need to do this becasue my favourite XP farm got ruined by changing zombie pigmans DON’T drop XP if kiled by anything other than player EVEN when in angred state in minecraft 1.21.5+
Please make zombie pigmans always drop XP and rare drops when killed in angred state. Affected versions are 1.21.5 and newer.
TIP: Make it be like in 1.21.4 or older versions.
Before fixing: Zombie pigmans drop XP and rare drops only when killed by player.
After fixing: Zombie pigmans always drop XP and rare drops when killed in angred state.
The bug that you are talking about is the bug MC-56653.
It was patched in 1.21.4 but i doubt that they will unfix it however you could try to make a petition on the official Minecraft feedback site (Minecraft Feedback) or make a post on the Minecraft suggestion forum on reddit (Minecraft's Suggestion Box).
But if you want a faster solution there is always the datapack GoldFarmFix (GoldFarmFix DataPack - Minecraft Data Pack) that reverts the fix to that bug.