Default How to root your own rom?

Hi - I am new in Android as Desire is my first such OS in use, however it is far more interesting as WM and not as boring as iPhone OS

Anyway - I know that there are some ways to get rooted ROM from xda or modaco, but is there a way to root my own?

aren't there two steps to root the phone? 1st to apply modified bootloader to allow recovery via pc (using gold card) and 2nd to apply rooted rom via SD card?

going further - what if I will apply stock rom, meaning i will unroot my device, then apply new bootloader performing the 1st part of the rooting process, then - somehow (this is the question how) - will apply stock rom in zip file and finally apply super user on top of it?

this are just my thoughts, i am not a developer and maybe i am wrong ?

Cheers