Yes, the game has both true res and divine intervention that don't require rolls and worry, which could work for Karlach's situation. If we got 7th level spells, or found a higher level cleric, they could cast regenerate (+true res/revivify if they had killed Karlach whilst removing the infernal engine, because yes she'd be clinically dead until a heart was placed in and reconnected). A wish spell is obviously OP and don't think Larian would go that route because if one isn't granted to the saviors of BG then I highly doubt it ever would in the boundries of this game.
It does shock me though, still, as I can't shake the fact that so many people seem to be so fine with Karlach dying because "shes basically a terminal patient and it's so beautiful that she accepted her time and made the most of it". Like omg have we played the same game? She does at first, then the longer we play and she gets revenge through Gortash, she is very much not ready to die. In her Origin ending she's not ready at all u til player choice, but even then she's heartbroken to part with the sky and sea again.
Which in turn makes the "ending she deserves" so bullshit, because she has to go back to Avernus to survive, which she ultimately wants to do (live, that is), but at what cost? Even with Tav and potentially Wyll, she'd have to fight all of Zariel's forces if that's what Zariel decided she wanted. Yes, things are different than before. She's with allies, she's not alone, she's more powerful than ever and she's ready to kick ass - but she never wanted to go back there either. It all feels so wrong. Had this been a true DnD campaign, one would listen to what the players want and make it possible, even if extremely challenging to obtain, at least it'd be an option. And that's where this story fails to deliver. It doesn't even give us a fair chance. Not even a nat 20-only check to succeed.