There is the `page_init` callback, but this can't be used in local plugins. But you could use `extend_navigation`, and though it's primary use is to extend navigation, by this time all the relevant global settings have been initialised ($PAGE, $USER etc)
- In your plugin add a lib.php file.
- Assuming your plugin is a local plugin called myplugin, create the function local_myplugin_extend_navigation(global_navigation $nav)
- Do your stuff. You don't actually have to do anything with the navigation.
There's a bit about this in the /local/readme.txt file.
Don't use this if you're intending to output html.
If you want to catch events, then you need event observers: https://moodledev.io/general/development/policies/component-communication#event-observers. To view the list of events available go to /report/eventlist/index.php