The most advanced re-creation is within KeeperFX.
And yes, many of the engine-related and utility functions could be used for Magic Carpet or Hi-Octane.
But the rest would still have to be remade for each game. For example - events handling, in-game objects lifecycle, creating a drawlist for rendering - these are different for each game.
Also, whether use of such code would be helpful, depends on the method used when rewriting these games.