For #27418 - Hook loading is now thread-safe

Added thread safety mechanisms to the hook loading