Maybe you are looking for the postInstall hook? https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall/
It is written in the example section:
Another potential use is to act on settings or managed entities that are created during the installation (but not necessarily in order that you want them to be created)
I find the 'normal' way pretty ugly.
listing the args by name in an array, then
supplying the args, then
needing to pass by ref a NULL/dummy variable for each of the remaining 6 or was it 7? arguments - this is ugly and error prone and passing CRM_Core_DAO::$_nullObject is risky as it allows the hook to overwrite that so it's no longer NULL.
I think the ...