Dangers of modifying a manufacturer firmware I have a device that uses UBIFS instead of YAFFS, and the system partition is truly read-only. As a result, I can only modify the system partition by completely reflashing it. My device is also not fastboot-friendly, so the only way I can flash it is to modify the manufacturer firmware.

Naturally, I would like to root it this way.

If I modify the manufacturer firmware, test it in an avd, and it WORKS, and then flash it to my device using stock recovery, what are the risks/chances that something will go wrong?
The risks involved by reflashing a firmware are :
In case something went wrong during the flashing process (You should have to be very careful while it is flashing tho), The phone will be PERMANENTLY RENDERED unbootable, or you might PREMANENTLY brick your phone.
I strongly suggest you to not to try to do anything above if your device has a warranty from it's manufacturer, otherwise, You may confirm trying to attempt that.