While taking a shower I got an idea (of course nothing new, but it finally surfaced in my mind lol): why not use "special tags" in the template to be replaced (for the moment likely in the buffer) with pieces of template?
I know what you are thinking: "what the heck is this guy trying to say?".
Well, an example.
The current code:
// Skip nav link.
echo '
<div id="top_section">
<div class="wrapper">';
call_template_callbacks('th', $context['theme_header_callbacks']);
echo '
</div>
<div id="header" class="wrapper', !empty($settings['header_layout']) ? ($settings['header_layout'] == 1 ? ' centerheader' : ' rightheader') : '', '"', empty($context['minmax_preferences']['upshrink']) ? '' : ' style="display: none;" aria-hidden="true"', '>
Possible code:
// Skip nav link.
echo '
<div id="top_section">
<div class="wrapper">
<integrateThemeHeader />
</div>
<div id="header" class="wrapper', !empty($settings['header_layout']) ? ($settings['header_layout'] == 1 ? ' centerheader' : ' rightheader') : '', '"', empty($context['minmax_preferences']['upshrink']) ? '' : ' style="display: none;" aria-hidden="true"', '>
Then, the "<integrateThemeHeader />" will be replaced before sending out the template to the browser with code added by addons.
Yeah, it's not that different, but it gives some nice advantage, allowing easy duplication of "blocks" around in the page and less headaches with functions having to respect naming conventions, etc.
Just an idea I had few minutes ago, so not really developed.