For #27328 - Fix for subclassing hooks

- Previously, sub-classing hooks would only work if the name of the derived class was alphabetically after the name of the base class.
- Derived hook classes tend to be named the same as the base class which meant that the behaviour was indeterminate.
We are assuming the first parameter will always be a _HookCache instance, so could the inner method be :
```
def inner(self, *args, **kwargs):
     lock = self._cache_lock
     lock.acquire()
     try:
               return func(self, *args, **kwargs)
     finally:
              lock.release()
    return inner
```