Reasoning is very obvious, Wii U is biggest Nintendo fail with terrible sales but had some great games, so most of future Switch owners didnt played them, also Switch offers full handheld mode compared to Wii U, so totally make sense to port some good Wii U games (even some 3rd party games), its easy profit for Nintendo, while plenty of people who didn't had those games will be able to play them, some Wii U owners will do doulbe dip beacuse of full handheld mode, and Switch lineup of games will be stronger and more diverse in any case.
Ports are cheap and they can be done in months, so it's not like Nintendo could do new game or new IP for same time and resources they are spending on porting. And its not about Nintendo only, Sony and lots 3rd party doing same thing, even PS4 that dont have full handheld mode and where on PS3 much more people were able to play some of great Sony games than people were on Wii U. Sony ported TLoU, Uncharted 1, Uncharted 2, Uncharted 3, GoW 3, Journey, Heavy Rain, Beyond: Two Souls...
It's obvious that they want to bring wii u games to switch so they can make some money off of them since they didn't on the wii u but we don't know the rest of their reasoning behind the choice if there's more. Because nintendo doesn't have much of any 3rd party support, this could be easily a case of nintendo really wanted to fill in some of those gaps in between their major releases which is fine I guess. I think it does tie up their studios that could be used on something else.