Because if you had a logic layer capable of validating LLM's output, you wouldn't need the LLM.
I can easily ask an LLM to write be a function in a random programming language, then feed the output to a compiler, and pipe errors from the compiler back to the LLM.
What doesn't work so well is typing "pong in java" into a bash shell.
This isn't a perfect solution (not even for small projects), but it does demonstrate that automated validation can improve the output.