If you want to learn TeX, I'd suggest just learning TeX. Between the LaTeX macros and the power of plain TeX and TeX primitives, you can do pretty much anything you want.
You can use other languages to output a sort of "idiot's TeX," where you keep track of counters and do hard-coded formatting in your programming language of choice rather than allowing TeX to do what it's designed for, but as @David Carlisle already noted, you'll need to know some (La)TeX for that to work, anyway, and increasing the complexity of one language by adding another to it is generally a poor solution. In the vast majority of cases, there will be a package to do what you want; in the vast majority of the rest, TeX will be able to do what you want.
There's really no substitute for purchasing The TeXBook if you want to do this, and if you do the exercises you'll gain proficiency with doing lots of really interested things in TeX. TeX by Topic is also an excellent resource. Finally, because LaTeX has already automated many of the things that most people want in a typesetting system, and because there's such a huge body of packages to accomplish almost any conceivable task, you may want to invest in The LaTeX Companion, and of course you'll want to watch CTAN for interesting resources.
LuaTeX is apparently the Way of the Future (though LaTeX3 looks interesting, as well), so if you're going to invest in learning a programming language for the purpose of typesetting, I'd suggest Lua. Lua has the benefit of being pretty simple, as well. But for typesetting tasks, learn a typesetting language. That's (La)TeX.