* Capcom for example allows fan games as long as you don't profit off them. There are a couple of Megaman games for example.
* Konami allowed the fan game "Castlevania: The Lecarde Chronicles 2" as long as they did not profit from the game.
* Valve allowed the HL fan game Prospect - https://store.steampowered.com/app/399120/Prospekt/
And there are other examples out there. Nintendo could perfectly allow it under certain conditions. Did Sega not work for Sonic Mania with somebody who made sonic fan games for example?