Neutral NPCs going hostile for taking damage during the fight, and then there being no way to pacify them aside from maybe getting lucky that sneaking away and ending the fight might leave them willing to talk with a very negative attitude afterwards is utterly ridiculous.
What if I have no intention at all to be "evil" in my playthrough, and want to save and talk to some of these folks? Please don't suggest just not using any AoE in fights with such NPCs nearby. It's not just AoE anyway, skills like Ricochet, Electric Discharge, etc. can cause this, and its very easy to accidentally set off surfaces when you didn't intend to with single target abilities or by other indirect means.
One suggestion might be that if you heal the NPC to full health they stop being hostile to you. Another would be that if the damage happens during a turn that is not yours (like a surface you started ends up hurting them) that this does not count toward making them hostile, as it's not really your fault they are stupid.
Also, sometimes, sneaking away and coming back does not reset their hostility. Please make sure it does. If I didn't intend harm, I'd like the opportunity to apologize so I don't have to reload a save to do a quest or reap a reward.
Barring all that, if it is too hard to code, just give the option to elect to select them as an ally for the fight for the purposes of attacks, please. It's very annoying and not fun.