Both these movies turned out decent by simply ignoring 90% of what the games are actually made of. The Mario movie is very different.
Okay, agree to disagree on everything else (well, save for saying everyone else in Detective Pikachu was fogettable, Justice Smith and especially Ken Watanabe do not deserve that disrespect), but this part? Maybe for later video games, but adapting basic platformer stories directly into even 90 minute movies would be impossible.
The Sonic movies chose to take elements from later platformers such as Sonic Adventures with the human presence as well as the comics (though the second film does take elements from Sonic 3) in order to work. A first movie following purely the first game would have been a mess.
Detective Pikachu is an adaptation of the game Detective Pikachu, so your argument doesn't even work here.
The Mario movie technically deviates the most! The entire Donkey Kong Country cast is suddenly a major element despite never playing any significant role in any 2D or 3D Mario platformer (and you can't say the original Donkey Kong game, as that is canonically Kranky Kong when he was younger, yet the film has the DKC Donkey Kong be the one with a bone to pick with Mario). Mario Kart is thrown in (hell, Smash Bros as well in the Mario vs. DK fight) despite having no presence in the platformers. The Brooklyn element makes it more closer to the original Mario movie, hell they even return to Brooklyn for the climax (though the original Mario movie finishes the fight in Mushroom Kingdom, hilarious that THAT film technically had the right location for the climax even if said location was completely different in appearance) not to mention having Peach not be native to the Mushroom Kingdom either (edit: actually, wait, I forgot the original film does have Peach be native to the Mushoom Kingdom, so the original film actually got that specific element right over the new film as well!)
The Sonic films felt like someone actually went through the games and comics to figure out how they could work as simple films. Detective Pikachu was someone adapting that specific game and doing a damn good job of it. The Mario movie is someone quickly throwing together elements of the games, regardless if they were ever really connected or simply a spin-off (and hey, if we're just randomly grabbing spin-offs, why nothing from Paper Mario? The Mario sports games? Mario Party?), and also taking elements from the original film, because fuck it, as long as we fanservice the hell out of this film, people will gobble it up.
Sonic and especially Detective Pikachu had fanservice but also felt like some effort was put into the writing and could actually generate some laughs out of me. The Mario movie had exactly two elements that made me laugh: a moment with Luigi (which was already in the trailer so I laughed then, so no reaction in the theater) and the Lumalee yearning for death. The rest of the movie's comedy was stale, not Despicable Me 3/Minions bad, but just nothing noteworthy.