Visit any page on enwiki or mw.org and in the browser console inspect mw.templates , e.g.
mw.templates.get() mw.templates.get('user.tokens') var foo = 0; for (val in mw.templates.get()) { foo++}
there are 100+ keys in there, one for each loaded module. They're all empty objects, bar mediaWiki.templates.values["mediawiki.action.view.postEdit"] (which actually does have a template).
It's not breaking anything, but it's unexpected. I think the fix is to check if module's templates $.isEmptyObject() before adding, patch coming.