Yes. An LSP has to work along with the compiler, or it has to become an alternative compiler.
For example, from the article "Why LSP?" [1]
"It is known that compilers are complicated, and a language server is a compiler and then some."
[1]: https://matklad.github.io//2022/04/25/why-lsp.html