It is possible to add Mustache helpers dynamically to Mustache. I didn't see an obvious solution to add an helper in Moodle.
How can I add a Mustache helper to Mustache from a Moodle plugin or theme?
Please see my thoughts on helpers in my comment https://moodle.org/mod/forum/discuss.php?d=311119#p1245495.
In my first simple local Mustache test plugin my first approach was to just use the line
»$OUTPUT->render_from_template('local_mustache_tests/templatename', array('text' => 'Some text to show on the page'));«
But Moodle complained that there is no template »/lib/templates/templatename« (I don't remember the exact path - it just gave me the information that Moodle only looks for templates in the core templates).
When I looked at the Moodle code I saw what you described above - the JavaScript template library browses the system for templates but from PHP only templates included via renderers/renderables are found. I would prefer to be able to use Mustache in Moodle with PHP and JavaScript with all flexibility Mustache offers.
For core code I see advantages to uses a few common patterns. But as a plugin developer I would prefer to be able to use Mustache's features and don't have Moodle lock Mustache away from the plugin code. Probably it would help already to make the »get_mustache« method public and not »protected«.
If I had access to the Mustache instance it would be easy to tell Mustache about additional template sources.
When I looked at the code again just now while writing this comment I understand the reason why Moodle implements the Mustache template handling in a special restricted way: with this implementation Moodle can guarantee that templates can be overridden in themes. If plugins could add their own templates overriding these plugin templates would be more difficult.
I am not sure if it might be possible to implement a more flexible template integration in Moodle.