Yes, the templates and HTML entities are part of the page source, but they are not what the reader actually sees and therefore not what LanguageTool should check. If you use wget to download the Wikipedia pages, all templates will have been expanded, and LanguageTool could deal with the remaining HTML markup.
We can’t just deal with the HTML, as we need to make changes, so we may not lose anything compared to the original markup. If you’d like to help, the proper solution is probably to use Parsoid: Parsoid - MediaWiki