[mlir][cmake] Fix missing entries in `tablegen_compile_commands.yml` (#147516)
Depending on the order of CMake includes the
`tablegen_compile_commands.yml` was previously missing entries due to
being deleted after a `tablegen` commands.
This PR fixes this by 1) making sure `AddMLIR` includes `TableGen` such
that new compile commands are added to a fresh YML file and 2) using an
include guard to ensure the file is cleared exactly once