In a perfect world "maintaining discipline" is indeed the correct solution, but my experience tells me that humans cannot be relied upon to do that. Some individual humans can, but not the collective whole.
The discipline has to come from elsewhere. Either from the management (reducing the number of people you have to rely on from N to log(N)), or from tooling (reducing the number to log(1)).
As always, education is the silver bullet. Instill proper values, enable the skills to follow through, and in a mere 40-60 years the industry will be in a better place. As long as there is no incentive to mass-produce junior software developers on the cheap, we're golden.