I'm talking about games developed or published by Nintendo. Perfect Dark was published by Rare, it is not a Nintendo game. There's also plenty of M rated switch games but none are developed or published by Nintendo.
The reason why MS owns the IP is that when the Rare founders (the Stamper brothers) decided to sell the company they asked first to Nintendo which already owned 49% of the company shares Nintendo declined.
They found other suitable candidates (Activision, Microsoft) that desired to fully acquire the company for a hefty price tag but first they had to repurchase the 49% of the company shares Nintendo held so they made a deal with Nintendo: they would give Nintendo $100 million and the IPs ownership would be resolved with Nintendo retained the rights of everything concerning their original creations (basically the Donkey Kong and Star Fox franchises) whereas Rare would own their original creations.
If you wonder why Nintendo accepted the deal here the Rare developed million sellers released under Nintendo (first list) and the Rare developed million sellers released under Nintendo which Rare retained the control over the IP after the split (second list):