You also have to ensure that every time you update the .y file, you update another file in the source tree, when it’s really part of the build.
It’s annoying and would be similar to the maintainer mode builds that used to happen and confuse people.
It can be done, but the benefits are low. Most systems back in the day had lex and yacc available. Systems that didn’t, but also that needed a compiler were rare, and the vast majority of the time you just cross compiled in those situations.