I would ascribe that to these communities evolving differently. There is no reason to assume that the popularity of LaTeX tracks the popularity of programming languages. It's a type setting system. And that doesn't even take into account communities that exist parallel to SO/SE. Surely there exist communities today for LaTeX that have been around since before SO began its life.
> Surely there exist communities today for LaTeX that have been around since before SO began its life.
Yup, TeXhax has been around since 1986 [0], and comp.text.tex has been around since 1983/1990 [1], and both are still somewhat active.
[0]: https://www.ctan.org/pkg/texhax
[1]: https://tug.org/TUGboat/tb45-3/tb141lucas-usenet.pdf