We're in the process of exposing our own compiling API for SpanDeX (https://spandex.io) already so this is good timing. Another benefit is that features available with online services could also be exposed to LyX users.
If you do end up deciding to use LaTeX, please consider http://SpanDeX.io! Not sure when you intend to start writing but in the next month we plan to push out some really robust reviewing/editing features. I don't think we've had anyone write a book on our platform yet so it'd be interesting to see how that goes. Anyway, if you end up going this route feel free to reach out to me if you have any feedback!
Oh man, this is really cool. Great job. I'm the co-founder of http://SpanDeX.io (which I see someone already commented about) and we love seeing this kind of stuff. Great to see LaTeX getting implemented in a really useful way!