Thinking about it now, Mario going over the same Mushroom Kingdom again and again is a relatively recent idea. SMB and the Lost Levels takes place in the Mushroom Kingdom but the titles from the same time frame do not.
SMB 2 - Subcon
SML - Sarasaland
SMB 3 - The expanded Mushroom World, suggesting that the Kingdom is just a small piece
SMW - Dinosaur Land, where the main characters are on vacation
SML 2 - Mario Land, some sort of kingdom where Mario is king. Stupid and doesn't fit well with the rest of the series but it still isn't the Mushroom Kingdom
Yoshi's Island - Uh, Yoshi's Island, duh, which is an area in SMW but this game is a prequel which could explain why it does not quite resemble the area from SMW
SM64 - This one is clearly in the Mushroom Kingdom, though it is entirely in Peach's castle, which was not visited in SMB so there isn't really a continuity error.
SMS - Isle Delphino on vacation
SMG - Fuckin' OUTER SPACE
Super Mario RPG made the Mushroom Kingdom into one area of a bigger world, which lets it work reasonably well with the platformers (and at that point no civilian area of the Kingdom had been visited so a town with NPCs was new territory). Paper Mario didn't make any effort to fit the other games though. I think that whole thing takes place in the Mushroom Kingdom.
Anyway there seemed to be some effort on Nintendo's part to move Mario around to new areas in different games and a lot of the inconsistencies are when different devs work on it (EAD was consistent with other EAD games, Intelligent Systems with there's, etc.) The idea of Mario platformers just taking place in the same Mushroom Kingdom again and again is, surprise, a modern idea introduced by the NSMB series.