There are many forces apart from incompetence acting upon any non-trivial software project. There are compromises to be made, and risks to be evaluated.
In short, there are factors that have nothing to do with the code that affect the quality of code.
The larger the organisation, the greater the tendency towards failure to understand, failure to communicate, and failure to complete. It isn't simply a question of architects, coders, testers, and documenters doing their very best.
There are some coding projects that are as essential as housing, in the sense that defects might cause death. But the majority of coding done in the world is slapped together and discarded within a five-year cycle.
What the heck, if it's for revenue recognition, release the prototype and hire e-workers to post favourable comments on some Web sites!
To paraphrase the Shat, "Bad code... survives."