I’m pretty sure the Switch has been a huge success thanks to Mario Galaxy, Breath Of The Wild, Animal Crossing and Pokémon. It isn’t a massive success because of its form factor or input devices.
It's actually both. To be successful you have to have 3 things.
1. Compelling HW. This includes the console itself and the peripherals for it. If the PS5 was really weak against the Series X, more like a PS4 Pro 1.5, it would have been disasterous for Sony.
2. Price that suits that HW. Even with as appealing as the Switch was for customers, they could not have sold it for $399+.
3. Library of good games and exclusives, whether they be 1st or 3rd party. If Sony was also struggling to churn out games like MS, the PS5 would still probably be ahead, but it would not be being picked up at nearly the same rate as it is, now.
These things are reasons why we have seen some Nintendo consoles fail. Maybe they had the games, but the HW wasn't as appealing as the competition. It's also why Xbox has struggled these past two gens. The HW (outside of the console's actual design, which also plays a part) and price weren't bad, but they were lacking on good games. Most, if not all, of their good games were on the competition, plus the competition had good/great exclusives.