Then of course every few years the platforms change and that throws a wrench in the works.
Things take so long because so often everything is built from scratch and got to the point where it just barely works for ship, and then ship happens, everyone moves on (teams break up!), and the bespoke tech hyper narrowly optimized for the specific game is unusable for anything else.
But we have not talked about how things should even work in a specific game yet. It could maybe be seen as glue, and you need a lot of it. All the thousands of rules that needs to be programmed and fit together. A physics engine only deals with physics. Even an AI engine is discrete. It needs to fit with the game in mind.
And what is the game in mind, is it fun? That whole process of creativity to figure that out also takes a lot of work and time. The game designer's job. Then the tweaking of values, how much damage should the attack of enemy B take?
It is an enormous art and engineering puzzle that is solved together from usually a pretty blank canvas.