That's generally how it's being done. The robot reads the code and writes specs. Then another robot reads the specs and writes code. If courts still accept the traditional clean room defense (and why wouldn't they?) then they're probably going to say it isn't a derived work.
It looks like the big catch, the actual source of uncertainty, is that the instance of the robot that reads the specs and writes code, may have seen the original code as part of its training data. That'll be enough to keep it from being a true clean room. In those cases, you'll be totally right.
But for any particular given project, was it trained on the original code? That'll be a case-by-case thing, and I think in a very long-term way, the answer will increasingly be No, simply because codebots' need to keep training on newly-published code, will diminish.
As an analogy, imagine you're a human author, and for some weird reason, one thing you like to do is have people tell you high-level plot summaries (specs) and then you write a detailed story from that. Someone says "the moon is unusually bright one night and people fear something bad has happened" and you write a story much like Larry Niven's Inconstant Moon, from that prompt alone. And you do this with 100 more stories, and most of them honestly don't appear to be derived. You take specs like "bombardier has crazy war experiences" and your resulting story is nothing like Catch-22.
But then one day, you're up in the attic and you find an old box that's been sitting there for decades, and inside, you find an old, worn, dog-eared paperback of Larry Niven stories which happens to include Inconstant Moon. Oh shit, you must have read that 45 years ago and then somehow "forgot" that you had, so your story wasn't truly independent of Niven's work. Your story turned out to not be "clean" at all, whoops! It was a derived work after all, because you read it ("trained on it") when you were a kid.
But the other 100 stories? Nope, those really were clean. Your story-writing process was almost legally foolproof, except that you had to learn reading and writing at some point, so your childhood favorites needed to be off-limits.