Steps to reproduce the issue
Summon an invulnerable villager: /summon minecraft:villager ~ ~ ~ {Invulnerable:true}
Strike it with lightning: /summon minecraft:lightning_bolt
Expected result
The villager is not affected as it is invulnerable.
Actual result
The villager is converted into a witch despite its invulnerable status.
Duplicate of MC-96261.