If running the code requires a copy of the game from Steam or GOG, and the code's entirely from scratch, then as far as copyright goes it ought to be fine.
It would be better if someone else reverse engineered the file formats in question for you and you implemented the loader entirely based off of that description, so there can be no allegation of decompiled code having made it into your version.
Trademarks may be the larger issue. You'd have to be careful how you describe the project. But depending on which game (more importantly, which publisher),
it can be done without getting a takedown notice. See that list to get a sense of the success rate of such projects and to get an idea of what their legal exposure was.
The short version is that as long as you don't distribute the assets, you're not infringing on copyrights. As for trademarks, if it's descriptive use "This is an engine reimplementation of such and so by them and such" and not "This is such and so" or "This is an updated version of such and so by them and such", you're only using the trademark to say what this is in relation to that other thing, not claiming to be this thing or a continuation of it that might confuse people to think it's official.
With that said, even staying within both the letter and spirit of the law doesn't stop an IP owner from sending a nastygram. As an example: If you're trying to recreate a game by a certain Japanese company who had a bit of hit with a game starring a plumber, forget it.
(I'm not a lawyer, nor do I play one on TV, but having been in the software game for 30+ years, you pick up more than you want to know about IP laws by sheer osmosis. Still, this is just how I see it, not legal advice.)