Code has an invisible attribute "confidence" associated with it. All code has it. So-called "battle-tested" codebases have a high value, newly-written stuff starts at low values, and the only two ways of increasing it are 1) rigorous testing and 2) actual usage in production scenarios at scale.
AI can generate "confidence" only in very limited amounts. It can help with testing, but that becomes very expensive and hard once we leave the realm of tests that can be simply written with code, like unit tests. At some point, the only way to increase the confidence in a codebase is actual testing with actual, real user interaction. And once that's maxed out, the only way to further generate more confidence is to get it into production and let real users (not test users, production users) find the remaining bugs no tester and no AI ever managed to hit.
This is the sole reason why AI doesn't make code "disposable" - yes, it can rewrite any codebase far more quickly than any human, but that new code will start at low confidence values - AI cannot transfer the confidence that the old codebase achieved simply due to being smashed against reality in production use to the new code it writes.
This is also the reason why it still makes sense to maintain libraries, even though AI could not just theoretically, but also practically write a lot of functionality from scratch that we usually import into projects via open-source libraries: the newly written stuff doesn't come with the same confidence as the already-battle-tested library does.