Earlier quoted context omitted.
The issue here is this appears likely to have been created by disassembly rather than pure study of behavior. Is that legal in Europe?
Disassembly by a team that results in new code written by the same team is not legal in any country that enforces copyrights. That includes the EU. Possibly excludes Russia and probably excludes China unless the owner is a large Chinese company. In fact I'd be surprised if this code isn't taken off GitHub by a DCMA from Microsoft, as soon as it hits their lawyers' radars.
It's not illegal in itself. But you are easily opening yourself up to claims that the code you have written has been "tainted" by the disassembled code you have read and has therefore become a derivative work, which is going to be very to defend hard against.
Also note that even if it is decided that you have made a derivative work you might still successfully launch a fair use defense on the grounds on interoperability, see e.g. Sega v. Accolade[1].
That said, doing a proper clean-room reverse engineering with two teams kept separate is a much safer approach.