The Pragmatic Programming publishers do it all in LaTeX and they even error check the source code samples with a linter or compiler to ensure they are correct. Entirety of everything is kept in git revision control. This allows for fast errata fixes and everything is PDF. They can send the book to be printed dead tree style but programming changes so fast by the time a paper book is printed and shipped whole chapters need to be rewritten.
LaTeX is so much more than a mathematical typesetting system. It can do it all and automation can use whatever programming language you wish. LaTeX is all text all the time until you render. You still need graphics and art. But it’s got typesetting more than handled.