Here's why: Everyone (on the ground floor at least) knows that the code is terrible, but the organization is not optimizing for good code. Code quality is simply and literally a non-goal. The goal is to deliver Projects, where a Project is a unit of work which advances someone's career, whether it be an IC, a project/team lead, a project manager, etc. Now, it's okay not to internalize that goal for yourself; but you've exposed yourself as not understanding that this is the goal that everyone else has. Unfortunately, this makes you a liability w/r/t the goal.
There are ways to advance other goals in the organization, and I suspect these organizations only survive as long as sufficient people are doing just that, but they all revolve around making other goals coincide with The Goal described above.
Note that The Goal isn't a secret or taboo; it's explicitly acknowledged in some organizations. Not so long ago at Microsoft, for example, it is known as "impact" and is the explicit top-level metric for performance review. If you can figure out how The Goal it's expressed in your organization, you can attempt to rescue the situation by explaining that what you really meant was you want to advance The Goal (eg. "improve my impact") by delivering improved code quality in future projects which will have such-and-such an impact on visible metrics.