Hi Niklas,
I'm glad you found a way to do what you wanted to do. However, in general, I recommend to avoid making changes in the core of mojoportal like in your example. Once you start down that path you make it almost impossible for yourself to get future upgrades and bug fixes of mojoportal because if you upgrade you will lose this customization or else have to add it again to the new version.
Sometimes it is impossible to meet requirements without making changes in the mojoportal code and maybe this case is one of them but maybe not.
There is one possible solution I can think of to put the same existing content on every page. We have a control named ModuleWrapper in Web/Controls folder. You can add it to your layout.mast of your skin and configure it to show a specific content instance on every page something like this:
<portal:ModuleWrapper id="mw1" runat="server" ConfigureModuleId="17" />
If I were trying to do the things you are doing in this code like adding a new Html module, I would create a control that wraps this logic and also put it in layout.master. The control could get a reference to the current page, check if the content has already been added and if not then add it.
The main thing I'm trying to emphasize is I recommend finding a way to keep all of your custom code in your own external projects rather than forking the mojoportal core by puting your customizations right in the core code. I'm working every day to improve mojoportal and I want everyone to be able to get the improvements going forward.
Best,
Joe