In an odd way, you could argue the Wii U was a good thing for Nintendo. Yes it failed, but at that price point it was as good as a semi-portable console could have been for the time.
It was clearly a precursor for the Switch which has been a huge success, and if they hadn’t had gambled with the Wii U and gone with something a bit safer, they may have been stuck with a mediocre console with a medium-sized user base that was never going to compete with Sony or Microsoft.
As only 12 million people had a Wii U, it made the argument to launch something new earlier than they otherwise would’ve a bit easier to make. I’m not saying it saved Nintendo, but being able to learn a lesson, improve the tech and release something truly innovative in a relatively short amount of time certainly helped turn them around.