The Wii U and Switch are ultimately different consoles, with different markets.
The problem with the Wii U was that it was a home console that was barely more powerful than the 360 and the PS3, but it was released right at the end of the 7th generation of consoles. For the average consumer, there was little reason to get one, because you could have essentially the same experience on the 360/PS3 that had already be out for years, had a bigger game library, and were ultimately cheaper to get. So you would only really buy a Wii U if you wanted to play Nintendo games. This led to a console that only really had one purpose, and a very niche audience.
The Switch though, is different. Whilst it isn't much more powerful than the Wii U, the fact that the Switch is portable opens it up to a whole different demographic, and poises itself as more of a 3DS successor, rather than a Wii U successor (though it does ultimately replace it). This gives the console a whole different expectation. I don't expect Assassin's Creed, or Call of Duty, or Battlefield, or any other AAA big-shot to be on a portable console, so im not bothered by their absence, but the ability to play a game like Skyrim on the bus, gives it a whole other use case that a PS4, Xbox One or gaming desktop could never match. This makes it unique and desirable, even if the library of games is limited.
Personally, the Switch is my favourite console of this generation, and that is because it does something different. I have a high-end gaming PC, a PS4 Pro, and a standard Xbox One, and all 3 are sitting on my desk vying for the same attention, because they are all static devices, and all play the same games - aside from a few exclusives, here are there. The Switch on the other hand, allows me to play a whole host of great Nintendo games, and a bunch of really great indie titles, on the go - and that makes perfect, because it allows me to play games in scenarios that I couldn't have done before.