> It's small teams that were together from the start. Going through the initial setup of a project makes all the difference. When people come later, they lack the intuition that comes with being around when all the structural decisions were made. Early people make tradeoffs and bake good and bad practices into the pipeline, later people are told not to touch certain things because it's more complicated than it looks or will break something else that doesn't seem explicitly connected.
I've also seen this happen and agree with your analysis that it's probably not related to the programming language - it seems more like a problem with how the thought process behind those decisions is (not) recorded.
Short of making every project (and the codebase it results in) live for a short enough time to guarantee that nobody new will ever have to look at it, we've got to collectively do a better job of being able to explain the "wtf did you do that?!" aspect of development.