I don't think people realize how huge Mario's cast actually is. Mario has just as much, if not more, character bloat than Sonic. The difference is that Mario's characters get a massive pass because most of them are relegated to spin-offs or exist as quirky NPCs, bosses, or playable characters.Mario can introduce some random dude like Captain Toad, Nabbit, Lubba, Honey Queen, King Bob-omb, etc. and nobody really questions it because they're just treated as another weird addition to Mario's world. Even the RPGs have a ridiculous number of characters that people get attached to.Sonic gets way more scrutiny because its characters are usually treated as actual characters rather than just pieces of the setting. If Sonic introduces another animal OC, people immediately ask what they add to the story when we already have Sonic, Tails, Knuckles, Amy, Shadow, Rouge, Blaze, Silver, the Chaotix, etc.Meanwhile, Mario can have 50 different recurring weirdos because the games aren't really asking you to keep track of their relationships or character arcs. Most of them can just show up in Mario Kart and nobody cares.That's really the difference. Mario has character bloat, but its storytelling makes that bloat almost completely harmless. Sonic's characters are much more noticeable because they're expected to actually function as a cast.So I wouldn't say Mario has avoided the character bloat problem. They just figured out how to make it harmless.
Mario tends to save the character arcs for one-and-done spinoff characters, like picrel, a canonical suicide victim.