Yes - “bad guys” can and should win when play and player choice supports it. Sometimes all the PCs may even die. At least this is my attitude towards TTRPGs. I don’t think the potential “unfun” involved in character death or even the death of the entire adventuring party, setting or campaign is sufficient to change playstyle when weighed against the fun for players of knowing that their decisions in game matter, and that bad decisions can have negative consequences up to and including having to roll up a new character. This is the distinction between a TTRPG narrative (mutually controlled by players and GM without a predetermined plot line and ending) and a fictional narrative (controlled by the author with a known - even if hidden - ending and plot structure). If players are to have authorial power - even if only over their character’s decisions those decisions must have the option of creating negative consequences - and in a TTRPG the greatest negative consequence is PC death, the requirement that to continue playing the player needs to create a new character.
To me at least the fear that your players will suffer enough to ruin their game if they suffer defeat, if their characters are destroyed, if their risky gambits don’t succeed, is less fear and more condescension to one’s players. Fudging dice on the fly, changing rules, allowing exceptions and sending in the deus ex machina when things go off the rails is as much a form of antagonistic GMing as fudging dice to arbitrarily kill characters with undetectable traps or unbeatable enemies. Both evidence a lack of trust in your players’ intelligence (their ability to understand and make decisions/weigh risks in a fictional world as well as their ability to detect the GMs heavy hand in creating illusionism) and maturity/character (their ability to live with the consequences of decision or make knowing choices). The savior GM may be acting out of kindness and sympathy, while the “rocks fall you all die” GM is malicious and sadistic - but either way the players autonomy doesn’t exit in the game in some meaningful ways. If the GM is showing such disdain for the players, how can the players trust them? The table quickly tends to dissolve into nasty bouts of protective or anti-social behaviour in and out of game (PVP, rules lawyering, murderhobo cruelty to punish the GM by destorying the setting)
None of this means that all defeat must end in character death (as you suggest). Some of my most memorable times as a player have been slipping away narrowly from a set of bad decisions and rolls, the party coming together to rescue a fallen member and flee in good order, or one character sacrificing themselves to save the party - none of it as a pre-plotted narrative arc, but as in the moment decisions by friends playing in a fictional world. A GM that is arbitrating the setting’s response to player action and random results for good or ill, but with an eye to discovering the story with the players - cheering their victories and mourning their losses without inserting themselves as the author of them. Such narrow escapes or well plotted overwhelming victories are far less exciting and meaningful if there’s no risk of loss (or no chance of victory).
Again, I think both mechanics and fiction allow degrees of seriousness, permanence and control: mechanically death saves, wound tables, healing times or resurrection possibilities all mitigate character loss in various ways without either removing the possibility or intruding into the narrative/turning defeat in to victory. Drawing a veil over death or playing with an “it gets worse” ethos allow narrative/diagetic/fictional ways of mitigating PC loss.
Thus is I was running a dirty, “dung ages” campaign about brigands and landless peasant clubmen robbing ancient ruins I might not want death to be easy - I might use a horrible wound table filled with descriptions of wounds gone awful so that characters didn’t always vanish the first time they were struck down but became picturesque liabilities for the rest of the party. In a light hearted “kids on bikes” sort of game character death would likely be replaced with things like being “grounded” for several sessions or “In the hospital with a broken leg” and eventually even something like “your parents decide you need to move to another town to keep you safe”. Neither of these systems eliminates the risk of defeat or loss of character - and that I think is important.