The agent will already have seen enough super optimised code and read enough material about it. It will read the entire repo you're in, and understand how the code should be structured and written to work efficiently. And anything it doesn't get at first, you write about in the AGENTS.md file and tell it.
Then it works. If you can teach a human to write specialised 3d rendering code, you can distill the same teachings to an agent in text form, and it'll work.
I am supremely confident of this, and I bet that neither you nor the author of the article has bothered to try properly.
American Fuzzy Lop usually manages to generate valid files of any format you want, using a genetic algorithm that the author didn't even call ML. AlphaGo trained against itself.
Such things aren't impossible when you can automate the reward function, though you might have to come up with novel techniques.