Defining hooks in lmodrc.lua works if the lmodrc.lua files are read early enough in the process of a module load. However, #490 (comment) shows that this is only the case under certain circumstances, and by no way a guarantee. We should probably move registration of the hooks to SitePackage.lua, as this is the officially document location for hooks https://lmod.readthedocs.io/en/latest/170_hooks.html?highlight=hook#hook-functions