The pattern for making an engine - which is also where the best engines used by various game studios came from - is to follow this pattern:
- Make a game. Don't worry about “engine”.
- When the game is done, figure out your second game.
- Make a second game, stripping out what you didn't need in the first game and adding what you need in the second game.
- When the second game is done, figure out what you need for the third game.
- Make a third game, stripping out what you didn't need and adding what you need in the third game.
- At this point, the stuff you've built for the first three games is your engine.
This is actually where many of the big engines came from. Unreal Engine came from a game called Fire Fight, followed up by a game Unreal, followed up by Unreal Tournament, which was then shared as an engine called the Unreal Engine. C4 Engine (which is not as popular because it isn't free) grew out of Terathon and games that were published through Sierra and Sony, eventually becoming a licensed engine. Many studios were bought by companies like EA, Activision, Ubisoft, etc., in part to acquire their engine technologies that they had developed with a series of smaller successful games.
Over the years I've worked on various company-internal engines, Lightbright, Glycerin, Slipspace, Quake\GoldSrc, etc, that evolved from the studio developing game after game.