People forget how much has to change for one video game company to make serious inroads to another company's share of the console market.
Atari basically imploded leaving the way for the NES. Nintendo was gutsy as all hell back in the day, walking into toy stores, post crash, and trying to get them to stock a video game console.
Genesis/Megadrive launched up to 2 years earlier, had an amazing ad campaign, and ran with the familiarity of the Sega Arcade brand.
PS1 dominated its generation because, a mass 3rd party exodus from Nintendo, Sega imploding with Saturn, and the huge difference in production costs between N64 carts, and PS1 discs. Not to mention PS1 launching a year earlier, with an insanely aggressive price point.
Then you have the 360/Ps3 gen, where...
MS launched a year ahead.
PS3 was being sold $200 over 360.
There was a mass exodus of 3rd party devs from being Sony exclusive developers to making games for both 360, and PS3.
360 was better at running 3rd party games, making it arguably the more powerful console.
MS had a really damned good 1st party lineup throughout the gen.
Even with all that happening 360 still came slightly behind PS3 in lifetime sales. MS played the best possible hand it could, and Sony played pretty much the worst possible hand, with the lone exception being their stellar 1st party output late in the gen.
Finally, we have the current gen where MS pretty much burned their entire brand to the ground in 2013, sold their weaker console for $100 more, put their best content on PC, and basically gave up on making quality 1st party content outside of Forza, Gears, Halo (without buying up an already existing studio, which is just another variant on the old moneyhat trick). On the flipside Sony had insane 1st party output this gen, and had a huge number of 3rd party titles either launch 1st on Playstation, or outright never come to Xbox.
Oh, and as far as Nintendo goes, they had to massively change their strategies with both the Wii, and the Switch in order to make a comeback. I really don't think the Switch or the Wii needs explaining, so I'll leave it at that.