Japan became a handheld and mobile land, and home consoles are becoming more and more a niche product for societal reasons. It's deeper than Nintendo VS Sony, it's the type of gaming changing. Mobile became bigger than console gaming IIRC, and the Switch might also hit a ceiling after a while.
Still, Psvita flopped and Switch came out years after when the market is suppose to be worse, but is doing really well. Sure it's more gravitating towards mobile/handheld, but still Nintendo is succeeding with an hybrid console which is pretty expensive for a handheld in a market even worse where Sony failed with the vita.