Reset the template loader cache when reloading extensions.

When using Django's template loader cache, it's possible to end up with
stale templates after replacing an extension. We now clear the cache
when enabling/disabling an extension, or when we see that another thread
has done so.