I think you're being excessively reductive.
When you play Halo, you can get beaten, but then you try again and keep playing until you win. If you're playing Dark Souls and you die (and you will), you try again. The damage you take tracks how well you're playing, and having multiple moving parts in the game mechanics gives you more options to meaningfully respond to the challenges you face. "Have everyone roll one die"?! That's not at all what I'm calling for.
What I'm saying is, if you run a normal game of D&D, and the party loses a fight, usually that means the whole campaign comes to an end. If this were any other narrative genre, they'd be captured, or left for dead, or there'd be some dramatic intervention that kept the bad guys from executing them, but in a good story the failure still has narrative consequences.
We're playing a game, so we want victory to be earned, not presumed, and we want failure to sting, but if you were playing Legend of Zelda - Breath of the Wild, and the moment Link died you had to return the game to the store and never play it again, that'd be kinda stupid.
I'm not saying death shouldn't be possible. I'm saying death shouldn't be the most common failure state. When you fail in an RPG, the assumed consequence should be a setback that you can recover from. Actually having a character die should be much rarer. And actually having the whole party die should basically never happen unless it's intentional. Like, there could be mechanics so a player gets knocked to 0 HP, and you say, "Okay, you're beaten and will be rendered incapable to keep fighting, unless you choose to Risk Your Life. Do you want to accept defeat, or do you want to Risk Your Life for a chance to still win?"
Something like that.