I don’t understand why they did this, except in USUM, where the battle there is Lysandre 2 levels of incidental. At least Gladion admits the second fight was kinda pointless but then that begs the question of why they didn’t scrap it?
As for OG SM, there’s no reason I should be able to lose to a woman plotting to tear apart reality with wormholes only for the game to go “well shucks, we’ll give you the pity victory.”
And they were easy ways to write around it to make it have some sense:
Gladion Battle: Instead of essentially him lashing out/releasing pent up rage, change it so he was just about to go to the Aether Foundation but Hop stops him saying him and the player are coming as they're Lillie's friends too (and Hau is feeling guilty he was unable to protect Lillie). Gladion initially refuses saying it's not a game, they'll be risking their lives raiding the Aether Foundation but Hau (and the player) insist. Gladion then says if you can beat him in a battle he'll reconsider. If you win Gladion accepts your help no questions asked; if you lose Gladion will say during the battle he had some time to think and he could use the back-up, but since he won he's the leader and you have to follow his instructions. Gladion will then say there's no time to waste and all of you rush out.
Lusamine Battle: In SM, first change her goal from going to Nihilego's world to her wanting to bring the Ultra Beasts over. Than, win or lose, have the Nihilego that Gladion was battling decides to bail and it grabs Lusamine while she's in the middle of either ranting that she lost or boasting that she won; Guzma chasing after her via shoving everyone aside hence why no one immediately chases after him before the wormhole closes. Then when you find them in Nihilego's world, you can pretty much keep the Guzma and Lusamine scene as is but maybe make Lusamine a bit more out-of-it, clearly showing she's under the affect of the Nihilego's neurotoxin.
In USUM, well aside from rewriting that whole game thus would also change this scene, if we're sticking to what we got and just changing this scene I'd suggest making it more about Lusamine needing to buy time for the Ultra Wormhole to open big enough because her plan is to summon Necrozma instead of Nihilego. But, win or lose, having sensed Nebby, Necrozma's hand reaches out of the portal and tries to grab it... while Lusamine is still holding it. Necrozma grabs Lusamine and starts pulling her in, Guzma rushes in and grabs the cage Nebby is in causing Lusamine to lose her grip, and after throwing the cage aside Guzma jumps into the wormhole just before it closes.
To show that the main character isn't invincible and can, in fact, lose battles
unlike literally every other protagonist in the franchise who are so invincible they may as well be gods
literal gods
The issue I took it was the logic behind the reason you're battling.
In the Gladion battle he's just lashing out and after knocking out the first Pokemon of either's party (or his) it should be enough to wake him up and realize they need to raid the Aether Foundation to save Lillie.
If Lusamine's goals in SM & USUM was always to go to Ultra Space why did she bother battling when she could have jumped through the Ultra Wormhole right then and their? Why risk losing you chance to go into the wormhole you know can be unstable even when using Nebby? So my above suggestions changes it to being she wanted to bring the UBs/Necrozma to her in the Aether Foundation but no matter what he choice is ultimately taken away from her when the Nihilego/Necrozma grabs her.