It won’t replace good coders but it will replace bad ones because the good ones will be more efficient
Here's where we just start touching on the second order problem. Nobody starts as a good coder. We start making horrible code because we don't know very much, and though years of making mistakes we (hopefully) improve, and become good coders.
So if AI "replaces bad ones" we've effectively ended the pipeline for new coders to enter the workforce. This will be fine for awhile as we have two to three generations of coders that grew up (and became good coders) prior to AI. However, that most recent generation that was pre-AI is that last one. The gate is closed. The ladder pulled up. There won't be any more young "bad ones" that grow up into good ones. Then the "good ones" will start to die off or retire.
Carried to its logical conclusion, assuming nothing else changes, then there aren't any good ones, nor will there every be again.