A lot of it is also driven by the popularity of consoles and mobile devices which are still largely locked-down walled gardens. They intentionally make it difficult to share code between platforms too. But, soon enough game developers will get sick of writing the same code over and over again, just as OS developers did in the 90s. Once this happens you'll start to see a lot more ad-hoc code sharing which will pave the way for more engines being made free software.
For instance UE3 makes a horrible engine for open-world games since it's built on loading levels whole-sale and doing very little streaming aside from textures. If you need a game that requires 60FPS(racing, fighting/etc) something that is GC based won't cut it.
I've worked in in-house and external engines(UE3, Unity) and you always have to re-write large portions to make them work for your gameplay. There are fundamental tradeoffs that make it hard to do otherwise. At every project there comes a point where you no longer take unlevels from mainline, fork the code and make deliberate breaking changes to ship the game vision that was set out by the team.