Hi Monique,
I can discern three topics from your question and will try to answer them as best as I can.
transfering layouts from Mendix < 5 to Mendix 5+ version: Your best way forward is to recreate your layouts in Mendix 5+. The newly introduced layout containers are so much different from the old system that the most quickest way is to actually redo the basic layout work. (I interpreted your transfer statement as going from 4 to 5)
mapping between layouts and CSS files: If you inspect your generated page in any web inspector tool you'll find div containers with classnames like: "mx-layoutcontainer-top", "mx-layoutcontainer-middle", "mx-layoutcontainer-bottom" etc. These containers and classnames correspond to the type of layout container / page you've created in the modeller. All of these will have standard styling rules in the core that can be extended / overwritten in your theme. I suggest playing around with them in your theme css file to see what you can and can't do with them.
changing generated code: This is not possible for any standard Mendix component. And for a good reason as well. It would mean that every time the platform changes or receives an update, your work will be nullified. Custom widgets and basic index.html / login.html files will however give you the ability to alter some bits in your html output.
The dojo you refer to actually hooks into the custom widget creation topic. I'd not recommend using custom widgets for subjects like layouts though: You'll want a workable Modeller environment. Putting a lot of greyed out 'black' boxes in there (representation of a custom widget) will obscure what your doing in the modeller views.
In certain cases revolving around small interface issues you can however use add-on widgets like HTML-snippet or Format-string. You can type HTML or Javascript in these. Be careful though with javascript, you need to know what you're doing if you want to tackle any issues. A custom widget will in almost every case be a better solution then.
If you want to learn how to create a widget. We have a widget workshop and a web seminar is coming up next week.
I hope this helps.