That's the approach I'd favor. The existing
PHP code represents a lot
of good user-interface work for which PHP is perfectly suited. The
underlying stuff could easily be split up into multiple daemons (say,
one for wikitext, one for images, one for equations,...) that could
feed the PHP front-end.
The math module actually works alot like this at the moment, it's not
a daemon but it would be easy to make it one since it communicates
with the rest of the code through STDOUT and STDIN anyway.