Nintendo was 50/50 on home consoles before the Switch between success/winning the generation and ranging from disappointing (N64) to failure (Wii U and sadly Gamecube). But if you look at their success rate since Sony came along, it looks worse. Basically, Sony was the first competitor who can beat Nintendo and established an even greater worldwide dominance. Nintendo could have probably beat up Sega for another decade or two if Sony didn't enter the market. It's hard to overstate how crucial the N64 and Nintendo Playstation events were, especially since Nintendo never got that third party support back even decades later (they can get decent at best support like the Switch, but a far cry from the NES/SNES days). And then Microsoft entered the market, and while not nearly as dominant as Sony, they still take away market share.
But the bottom line is that when Nintendo fails at home consoles, they fail hard like the Wii U. When Sony "fails," they end up with the PS3 that sold more than the Wii U, Gamecube, and N64 combined. That is crazy to me. Of course, we are talking two very different companies. Sony is part of a much larger company that isn't focused solely on games, and they were able to cut the price of the PS3 in half and salvage the situation. Nintendo could have doubled sales of the Wii U if they cut the price in half (though it was never going to match Wii sales even if this happened because they product was still undesirable to the masses), but they would have to take a huge hit into their bottom line and they lacked other sources of revenue at the time aside from the underperforming 3DS. Sony had only one failure on the level of the Wii U in the Vita and they will probably never release another handheld as a result. If the PS4 had failed as well, they could have gone third party or gotten out the video game business altogether and it wouldn't affect their other departments. Nintendo doesn't have that luxury. They could have gone third party of course, but I think it's clear that console makers doing so has yielded poor results. Look at the struggles of Sega since going third party. I'm just glad that Nintendo found their footing with the Switch, the hybrid model is really genius, and I hope they continue it with a Switch 2 and never have a failure as big as the Wii U.