Because a good design doesn't overcome bad code.
In theory, a good design ought to be provide some insight into how that design can be tested.
Often tests only look at 'correctness'; does the code yield the proper output given the right input.
Ideally there should be some code quality metrics included in testing, and also performance benchmarking including resource usage.
E.g. in addition to required input/required output; required satisfactory runtime characteristics and code quality metrics (CQM)
Anyways; it may be a challenge, if the code quality metric is good enough, it could be used to overcome bad code by flagging it for review and rewrite