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.
I think thread_safe is a bit too obscur. What about "lock_guard" ? Or anything better that would express the idea that the methods are mutually exclusives, using to a mutex or lock or whatever to achieve that ?