Move the registration of the global env to after plugin resources

This prevents a user's template resources from getting overridden
by a resource plugin.

Change-Id: Idd1a5155dd28d662df8cdc44d190e24c84fd7a81
Closes-bug: #1236107