Nintendo bailed out straight after the GC, targeting a different demographic altogether and not entering the spec race. With the Wii U they sort of followed, which is a thing Nintendo shouldn't do. Wii U followed tablets in a half assed way and they got quite a bit of PS360 games. But you can say it was sort of a precursor to the Switch, the Wii U was one step away from being a handheld/home console hybrid. The Switch was, they found a way to merge these 2 markets.
MS lost because they didn't branch out but rather copied Sony. They did popularize online gaming on consoles and brought more PC IP over, but Sony was simply the de facto brand when it came to consoles. With exclusivity becoming more rare over time as costs rise, the de facto brand wins. Also, Xbox failed to build an empire. They mainly capitalized on timed deals like the GTA DLC, CoD promotion and celebrated games like DMC and FF as wins. Meanwhile they didn't build their own IP like Sony did. MS took Halo from Bungie and gave it to an incompetent studio, they took GoW from Epic and gave it to studios that do a worse job too. And Turn 10 is fucking up Forza Motorsport themselves for whatever reasons.
In the end, with third party exclusivity fading into obcurity, MS basically doesn't have enough firepower to differentiate itself from Sony. The Series X is a lot like the PS5, just with worse games overall.