Agreed. Luatex makes the following division of labour practical: work with data structures and manipulate fonts and the backend in Lua, handle moving about text and setting parameters in the macro language.
One thing I would like to see is proper static analysis tools for Luatex. Lua has tools like https://github.com/fab13n/metalua/tree/master/src/samples/me... but there's nothing of comparable sophistication for Tex, let alone code combining the two, which makes debugging needlessly hard.
The problem is that you can change TeX's syntax during the run time. I am not sure if it is theoretically possible to create such a tool for TeX input. That is one of the reason why I use (except for approx 10 lines of TeX code) only Lua code in my software. These 10 lines will disappear once there is a tex.initialize() in LuaTeX.
I'm quite sure flow-based static analysis can be done for Tex, the question is how expensive it is to perform and how useful the results are.
With respect to catcode-changing code, you can model its possible execution paths: while you can construct example Tex code where you can't infer anything past this point without having complete information from before, in practice with, say a package, you do have example documents which the package is meant to work with, and you can use that in the static analysis.
I've thought about this a fair bit, at least in the context of typical Plain Tex, but not written much code. I should try and enough time for a proof of concept: there's a lot that could be built on it.
One thing I would like to see is proper static analysis tools for Luatex. Lua has tools like https://github.com/fab13n/metalua/tree/master/src/samples/me... but there's nothing of comparable sophistication for Tex, let alone code combining the two, which makes debugging needlessly hard.