Honestly, I wouldn't put too much stock in it. A Hat in Time is a great game, but I don't think the devs were aiming to give it this deep, complex plot. It's kind of hard to answer some of these without running off the deep end into fanfiction territory since the game only gives explains the bare minimum when it comes to its world and how it works, however it is fun to over-speculate...
Now there are two possible perspectives you can look at when looking at Hat Kid's relationships with all of her former enemies at the end of the game - the in-universe story perspective, and from a writing perspective.
Through the course of her journey, Hat Kid interacts with a variety of characters who aren't necessarily the nicest; they all have a lot of outwardly negative traits that overshadow any positive ones they may have as well. However, Hat Kid actually winds up helping a lot of the characters she comes across, even if only to get her time pieces back, but the way she interacts with them does seem to affect them in a (usually) positive way.
This all pays off in the finale when Had Kid fights against Mustache Girl, and her positive impact on others allows all of her former enemies to find reason to side with her, and after the final battle, have a positive enough opinion of her to want her to stay. However, you can also just chalk everything in the finale act up to the common phrase, "the enemy of my enemy is my friend". None of Hat Kid's former enemies may have any personal attachment to her; they easily could have sided with Hat Kid because they knew she was their best chance of taking Mustache Girl out of power.
From a writing perspective, there could be a couple reasons/themes at play here:
As for your other question, at lot of these same concepts apply to Mustache Girl. She's definitely an underdeveloped villain. All we know about her is that she has a personal vendetta against the Mafia, and it's implied that she's the last remaining original resident of the island. My best interpretation is that she's a kid, with a lot of resentment and justifiably so, which has given her an extreme level of black-and-white morality, and like any angry kid she wants to take that anger out on the circumstances around her. However, at the same time, she also suffers from feelings of isolation and loneliness due to her situation, so when Hat Kid shows up and then refuses to help her deliver justice, Mustache Girl takes it as a betrayal because she loses both a means to get the revenge and friend she's always wanted to have.
While she's never outright shown interacting with anyone other than the Mafia before the finale, it's implied that she does run into the other characters when searching for other time pieces. There were references in the Alpha and Beta versions of the game of her causing problems for The Conductor on his train, and there's a dummied out section of the game where you were supposed to play as her in Subcon Forest where she'd meet the Snatcher. Also there is Mustache graffiti scattered throughout Dead Bird Studios implying that she's at least visited there before Hat Kid's arrival. She probably realized that the Mafia weren't the only ones she interpreted as "bad guys" on her planet, and thought she was justifiably in the right to do away with all of them once she'd gotten the power of the time pieces.
Once again Mustache Girl's character is really just another one of many perspectives laid out in the game. Just like in real life, everyone on the planet thinks that they're in the right and that their intentions justify their actions. However, when you look at it objectively, there is no "good guy" or "bad guy", no one's entirely right, and no one's entirely wrong.
Aaaand that was my over-interpretation of the characters in A Hat in Time... sorry for the long reply... I got carried away. I hadn't really thought of the game in that much detail before this, but your post did make me stop and think, so kudos to you!