The code was written by careful observation. The developers have not copied a single line of code written by Nintendo. Furthermore, the assets are added to the game by the player not the development team. No copyright infringement has taken place by this project.
Careful observation as it pertains to this sort of thing usually means you sit there with an emulator, maybe a memory viewer (think cheat search) but some even caution use there, and pixel counter. Careful analysis of your disassembler and decompiler (which is still a disassembler, just with some probabilistic steps for the output formatting), which is the only way this can happen*, then being the sort of thing that gets one slapped.
Usual comparison being so you want to make your word processor compatible with MS Office, a fine goal. Open new document in your particular revision. Enter basic text line, maybe two/two pages, save and see what the result is, change text, see change, make it bold, make it italic, make it underlined, make a hyperlink, insert a picture, insert a different picture, different justification, different font, tables next, columns maybe, page size now, landscape/portrait, repeat for all other 900000 functions remaining (though it will probably follow a pattern and you will soon run into the most people only using core functionality/good enough for homework for the kids) including what happens when you have a right justified bold italic underlined partial hyperlink in different fonts embedded in a table... The second however you bust out Mr Disassembler to watch how the original program itself decodes the file (MS office being famously incompatible with itself and bugged as you like, said bugs making things more difficult for the reverse engineering set if you are going for 1:1 with the original as you have to figure out what the crack smoking just graduated coding school type was thinking that day) and you are in breach of some kind of law or regulation** and your project (possibly also yourself in the eyes of some reverse engineering projects -- for a related one then Dolphin refusing to accept code from those that read the leaked documentation being an example of the logic in action) is tainted. I speculated later that Nintendo probably fear some kind of adverse result (is legal by some quirk, random judge decides actually the "for disabled peeps" that forms part of the backbone of emulation being legal stretches this far, maybe the interpretation of interoperability allows something here...) if they took action here so choose to leave it "grey area" and go after the resulting projects as that is the only thing I can imagine holding them back for stuff like this.
*there is bound to be some hidden code, or code with an activation condition so obscure that you will not encounter it during play/have enough of it remaining to fill in some blanks.
**other than debugging your code you could be thinking Nintendo stole some of yours so there are some scenarios where you want to apply it to the original code under general interpretations of law.
There are people that do the equivalent of the document example in games. Look at the assets of something, learn by play, possibly with some savestates and cheats and map editor to help things along, realise not all levels will feature all units/concepts, and you can make a pretty faithful recreation***/interpretation of things, if the engine is based on an open source one then figure out what changes (the devs themselves probably advertising them on the box -- clear doom clone but you can look up and down). It will however be a recreation/interpretation only, and the chances you get to a point where you compile to 1:1 of the original game... unless your original game is tic tac toe on the PC with all function names visible and coding the obvious plays it is probably not going to happen this century -- even minesweeper has a bunch of hidden stuff you are unlikely to find simply poking in the memory
https://tcrf.net/Minesweeper_(Windows,_1990) .
***though for the RTS and turn based strategy most go in for in these sorts of projects (seriously
https://osgameclones.com/ is full of them) there soon comes a temptation to improve the AI, and probably change things to work better on another front.