Thinking it over, I’d say The Super Mario Bros Movie– by establishing three things– actually did an okay job setting up why Bowser’s loyalty took such a sharp turn:
His apparent lack of an emotional connection with his army, Kamek included
His confusing infatuation with Princess Peach
His admission that his wedding with Peach was out of a desire to “be happy”
He desperately wants to be loved and can’t handle the loneliness of being surrounded by subordinate yes-men who rely on him for success, yet at the same time he can’t handle facing his own flaws. He wants the adoration of Princess Peach– a sworn enemy he sees as something of an equal– but reacts violently when she’s hostile toward his advances.
Then, after Bowser’s defeated and locked away, not only is he placed in an environment that encourages quiet self-reflection, but he forms perhaps his first-ever genuine friendship with Luigi. He knows Luigi– having kicked his ass and locked him in a cage– isn’t some obedient peon, but at the same time he’s compliant enough that he won’t dwell on the past, even in situations where Bowser exhibits some glaring red flags.
By neither having anything to gain by being friends with Bowser, nor challenging Bowser’s self-perception, Luigi earned his loyalty. Mario, on the other hand, still got under his skin, because he wasn’t willing to handwave the long list of war crimes for the sake of Bowser’s ego. For good reason too, because despite all the progress Bowser has made in controlling his emotions he’s still dishonest with himself; even at the height of his redemption he can’t help but rewrite himself as a victim who was “left at the alter.”
This leads me into the one and only time Bowser explicitly admits to any wrongdoing:
“Mario, I was a terrible father. He must hate me.”
“Hate you? Your son tried to chop my head off just to free you! He wants to see you… he could just use some guidance.”
Whether Mario realizes it or not, this was his accidental version of Luigi’s “love the colors!” and the point at which he finally earns Bowser’s friendship. Mario quells Bowser’s fear that Junior hates him, and accidentally gives him a way to escape the guilt he was feeling about neglecting his son; guilty feelings that, as Luigi pointed out, were a huge step forward.
Then, Bower reunites with Junior, who gives him all the love and acceptance Luigi offered on steroids. Junior was wronged by Bowser, is powerful and independent enough to stand as his equal, yet adores his dad with the rose-tinted glasses of a kid. Junior repaints all the bad parenting and terrible advice as fatherly wisdom, reinvigorates the connection Bowser had with his army, and treats his dad like an innocent victim whose suffering was no fault of his own.
Between both movies, Bowser’s loyalty shifted drastically between the good guys and the bad guys, but if you look closely his moral compass remained consistent. When he finally felt happy in the company of good people and genuine friends, he gave his all to please them. But in the end, despite his desire to change, he never genuinely cared about doing the right thing, and only cared about feeling loved. Naturally, the moment he was given an opportunity to feel just as loved without making an effort or acknowledging any wrongdoing, he fell right back into his old ways.