Welcome to the forums.
You would almost have to make alterations at the kernel level (the kernel is a partition that transfers requests of hardware to software an vice versa) . Not for the faint of heart, and certainly ONLY if you know what you are doing.
I have rooted several devices and flashed many ROMs. I wouldn't attempt this. ANY wrong move in the kernel code, and your phone could turn into a brick.
Not trying to scare you , but trying to show how serious this can get.
To illustrate: The bootloader (the first step in startup) would get to the kernel, and if there are any errors in the code for the kernel, the boot process would stop. There may or may not be a reroute to the recovery partition. If there is, you have a way out. If not, the there is minimal chance of saving the device.