Is there a point though, when badly written code becomes so hard to maintain and improve, that people would just avoid doing that altogether?
The reason "badly written" works for Open Source is that if code is useful - there will be someone in the future who will refactor it. In proprietary setting that only happens when the fate of the company itself (or a large chunk of the business) is at stake. Otherwise stagnation is king.