Remove singleton pattern from TemplateRegistry

This also defers template registration up until they are actually used.

Change-Id: Ieffe710451bb4645b996df2167a4105a349c0d06
Merge "Remove singleton pattern from TemplateRegistry"