Hi,
Thank you for all the information, it helped so much.
I'm having the following situation:
* Had old stock miui V12.0.9.0.QJGMIXM
* Had old flashed recovery twrp-3.4.0-15-surya-mauronofrio.img
* flashed new stock miui V12.0.1.0.RJGMIXM from twrp recovery, and magisk-v23.0.zip
* ended in bootloop
* used 'fastboot boot twrp-3.4.0-15-surya-mauronofrio.img' to flash new stock miui again, without magisk
* booted into system, no magisk (just the manager)

* flashed new twrp into recovery twrp-3.5.2_10-5-surya.img
* flashed magisk in twrp Advanced
* bootloop again
* new twrp is still in recovery
* flashed new stock miui, again system working, no magisk
My question here is, how to root it now i.e. how to flash magisk and successfully boot into system?