I know I could use something like hook_theme_suggestions_HOOK_alter() to add a suggestion, which would allow me to get a template rendered, but I wish someone would explain where the original ones come from in the first place.
For example, in the Twig debugging html, I'm seeing this:
<!-- THEME HOOK: 'page' -->
...but I don't know where that 'page' hook came from. I can't exactly grep for 'page' in core. Could anyone give me an explanation the order in which these things happen, and how they're connected:
- Something creates a list of possible templates to use (How?)
- Drupal grabs/renders the files specified from this list, from the theme or parent theme
- Something adds new suggestions to existing template names, allowing for specificity
- You can add your own template names to elements, which causes it to look for those files
Even a good direction to look in core would be appreciated.