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.
It was not the topic of these changes ... but ... this does not sound very thread safe, does it ? Would it be too much work to make it thread safe, and should be addressed in a separate round of changes ?