And they're not just limited to game engines either Webamp is a JavaScript application that reimplements Winamp in the web browser. Some projects are implemented in ways that the original developer did not intend for example, for a platform other than which publishers marketed it for. It led to so many ports being released that the community began to joke about what devices haven't gotten it running yet. The most common example that's often used is id Software's release of Doom in 1997. This skips the step of figuring out how the game works.
Some engines come about simply because they were inspired by the original game, and the programmer felt confident enough that no reverse engineering was necessary to make an engine that does the same thing. Alternatively, they can be remade based on a clean room design, in which the project implements the abstract features without having to disassemble the original, going by how components are expected to be used rather than how the game uses them. How the developers go about this process depends on their philosophy they may opt to decompile the original executable and have their own program rely on the original until all of its functions have been remade, at which point the original binary is no longer needed.