There are things that could have been done for sure, but ultimately I think the Wii U was an idea ahead and behind the times.
We already had smart devices, as in smart looking things, like iPads which are aesthetically far better looking than the fisher price tablet the Wii U had. But that gamepad was the, quite literally, big thing the Wii U had to distinguish it from the Wii or the other consoles.
There were some cool things you could do with duel video outputs, you know one player looking at the tablet the other player(s) using the TV, but ultimately most people play with their mates online now, or they're happy sharing a TV screen. For single player games, let's be honest, games that forced you to look at the tablet over the TV would generally have been better forsaking the tablet. An extra screen is fine on a DS but maybe less so on when you are looking up at your TV and then down at a tablet.
The unique things the tablet brought to the table weren't really good enough. The Wii had a gimmick that intuitively captured the imagination, while the true portability of the Switch and it's modern look are also great. Compare either of those to the Wii U tablet and even without Rufus Hound getting his sweaty paws all over the marketing it would have flopped. Like, what do you think parents would prefer; something their child can hold or a Wii U gamepad?
People can point at the name, the marketing, and all sorts of other things when it comes to the Wii U, but for me it all boils down this: The Wii U concept didn't capture the imagination of enough people.
And I like the Wii U tablet. I found it surprisingly comfortable, a convenient Netflix device, and it brought a lot of good to the fore in certain multiplayer games. But I can see why it didn't work for so many people.
For me, the more interesting hypothetical question is: If we had a Wii 2, which had about the same power as the Wii U but the gamepad was a separate peripheral you could buy that was compatible with all games as a controller, as a screen for when the TV is off, and as a second screen in some games, would it still have flopped?