Oh there's absolutely been a shitload of redundant spaghetti code under the hood, though the releases have sped up since the start of the Switch era which has no doubt impacted the development cycles.
Some of it's because the series is so heavily dependant on compatibility (being able to move Pokémon/items etc. forward to newer games) that they can't exactly rebuild everything from scratch within a reasonable timeframe without cutting off previous games like in Ruby and Sapphire - meaning each new instalment is just the previous game's already-clunky game engine with even more shit thrown on top. SV launching as a literal PowerPoint presentation in parts was inevitable really, this cycle isn't sustainable.