Right. Ultimately, Larian is creating BG3 as a video gane and not an RPG. In video games, you save scum, replay a fight until you learn the gimmick of the boss you are fighting.
In an RPG, the DM creates encounters that don't overwhelm and kill PCs but are fun and challenging. It is one of the toughest challenges of a DM, but that's why you use the Challenge Rating system WotC created for you. It is the DMs best friend.
I almost never put PCs in a Challenge Rating of Deadly unless it is meant to be a truly End Game fight, and even then I usually provide them with some sort of way out in case RNG is going poorly. Players in RPGs don't typically like to fail the entire quest they've been working so hard to complete, so I try to be careful not to utterly destroy them.