core: Add global 'template_modified_check' flag to disable template modification checks

This eliminates a bottleneck observed in z_template on a system under
load. When 'template_modified_check' is true, z:flush() needs to be
called to trigger recompilation of new / changed templates.