Bufotenina gave their in-character reason already, bullse. Each person's character is an individual if their player decides to think of them that way. There are many reasons why someone might decide to do something, including something like this; here are a few other non-reality-bending possibilities:
- Maybe you're playing a character that doesn't want to believe in abject, innate evil and is the sort to give any sentient creature a second chance, or perhaps they hope that by showing this good turn they might influence the creature's choices going forward. Maybe they want to believe that anyone can change, if given the right environment and the right chances.
- Maybe your character is the righteous, honour-bound sort, and cannot kill the creature while it is wounded and helpless, and feels compelled to heal it to fighting capability in order to dispatch it in a fair fight.
- Maybe your character is a pragmatist; This one entity is literally the only creature you know of that knows everything about everything that's going on with you, why it was done, and what the implications are. This mindflayer has literally all the answers. Your best shot for surviving yourself lies in knowing exactly what your situation is and what can or cannot be done, and this creature can tell you that, if you can make it. It can't tell you (much) if it's dead.
There are many perfectly legitimate possibilities.
==
For now, we can only assume that the fact that healing the mindflayer causes it to die (i.,e. that any direct interaction with it causes it to die, which seems to be the case right now) is, hopefully, a bug.
If you want to be sure that the mindlfayer is absolutely still alive, your surest option is to actually approach it with one character, and give it what it needs to heal itself; a brain snack. Then you can revivify the killed character afterwards. This will definitely get the mindflayer up and able-bodied again, but do be aware that it will immediately attack your party if you do this, if it sees them, and its mind blast will generlly wipe out first and second level characters. You could do this in stealth so that he doesn't see the rest of your party to attack them ,and revive the downed character from afar, if you're careful, or if you don't mind waiting, you can stay away with the rest of your party, and just wait until you can get the scribe to revive them at camp for you.