I also recommend that you don't use any kind of TWRP, they usually cause hardbricks, switch to fast boot and do everything there...
Even if it takes more work temporarily, it will cause you less headache.
It's really easy to root through fastboot and it's much safer, besides not having to format your phone, just patch the boot img through magisk, and use a vbmeta
1 -fastboot flash patched-magisk-boot.img (boot.img here)
2 -fastboot --disable-verification --disable-verification flash vbmeta (vbmeta.img here)
I'm not going to put the files, but if you look, you'll probably find it, and just follow this and it will work