Completely revamp the implementation of hooks to comply with up-to-date best practices.
Closes #3525354