The bug
If all villagers are struck by lightning during a raid, the villagers will then become witches but the raid still continues. You can however get a raid victory with no villagers and can still achieve the "Hero of The Village" advancement and status effect.
To reproduce
Cause a raid in a village
Run the command to turn all villagers into witches
/execute at @e[type=villager] run summon lightning_bolt
→ ❌ The bossbar then fills up as the villagers that are now witches join and raids the village
You can however end the raid in a defeat by just destroying the all of the nearby workstations/jobsites, beds and bells in the premises.
You can see that I was using the /effect command and gave "all nearby villagers" Glowing, no actual entity was found as the witch near the lectern was the villager.