It has been pondered for many years now. We will skip the "Nintendo is just a money laundering front" theories, for while stranger things have happened (see the story of the ngage) it is not all that likely. Same for "they are artists that just want to ensure they have a means to do their vision", "the upper brass is all afflicted with a terminal case of the stupidity" and "Nintendo need to have a loss for tax purposes".
I can sort of understand Sony catching them off guard when it came to the PS1 and them suddenly finding themselves not as much of a key player as they were in most regions during the NES and SNES (technically Sega were doing what Sony would be doing). In case you were unaware then Nintendo of the NES and SNES era exerted massive influence on their third party devs as far as content standards, and would often deny them the chips to make the carts or sell them far fewer than they really could. When Sony, and Sega before them, treated other companies like they were partners then that is part of the reason they flocked to them despite being a smaller or unproven market.
By some accounts the Nintendo of today are far from a joy to work with, and not anywhere near as helpful as the likes of EA, Ubisoft and the others (or them of the mid-late PS360 era as most of the talks I have seen are from around then), but by no means bad. On the other hand if Sony, MS, Ubisoft, EA, Activision and so forth will headhunt projects, pay them lots of money to do things and focus them on MS and Sony devices these days and Nintendo just allow them the chance then I can see that being a thing. It is an odd move but hey.
Some have speculated whether it was the push towards "mature" themes that the gaming industry at large went towards and that would mess with their "family friendly" niche. I have met a general notion that Nintendo are the only ones playing in that world a few times now in the general public, from some ROM hacking types (if you hack ROMs then it is a fairly safe bet you are invested in this games lark), and there have been a few notable versions of that from devs as well (amusingly one of the people that ultimately made ID software and so Doom, Quake and all that was noted as not caring for the action/violence/blood/gore direction).
There is no reason you can't do both -- Disney quite notably owns or owned Touchstone pictures, Miramax, Dimension Films and a few others like that which distributed/made/financed stuff you are unlikely to see on the Disney channel any time soon.
Some wondered if they made enough money with the first party stuff they did (or from hardware) that they were happy with that and anything they got beyond that was just gravy. Given most companies are duty bound to make as much profit as they can then it would seem strange to rest on their laurels as it were, and possibly the sort of thing your shareholders would care about.
Some wondered if they only cared about Japan, where they do pretty well, and the rest of the world was something of an afterthought. While unlikely to be the sole reason I can see an element of this being at play, certainly back in the day.
I too have no idea why -- everybody that has the third parties does well and every time they had they did well (NES, SNES, GB/GBC, GBA and DS), since they lost them then it makes it a far harder sell (I have skipped the 3ds and probably will do the Switch as well because of lack of third party support).