Bug? Enemy suicide

Not sure if this is a bug, or possibly i just got lucky.

Accidentally left a Terror Wight alive too long - all it’s allies had died, and its defence was too high for my creatures to do much to it. Instead of knocking my creatures out one by one, it cast Dark Ritual on itself, essentially gifting me victory in a fight i was expecting to lose.

I feel like there should be something stopping enemies from killing themselves?

edit: full battle history here, in case there’s some relevant effect that i’ve missed https://pastebin.com/JBEv4Pck

Thanks, going to remove spells like this from enemies in the next patch!