Yes, you have to install Android Platform Tools package which includes "adb" and "fastboot" programs, it should be included in your distributions package repository.
Magisk integrated root works only when installing unrooted system, 13.2 was just released.
This might remove all root stuff:
XDA - osm0sis unSU Script
If TWRP problems, always try latest official from https://twrp.me/.
Never wipe system, rom install overwrites it anyway.
You could try reboot to recovery from TWRP and then try install again. If it does not work MiFlash Xiaomi official firmware, install TWRP and xiaomi.eu again.
Could be related to unofficial unlock method (if it was unlocked by seller). MiFlash dev rom with "clean all and lock" option and use official unlock tool.
Use MiFlash in EDL mode, it should work even if something is wrong in software side.
Yes TWRP backup and restore.
package_extract_file("firmware-update/NON-HLOS.bin", "/dev/block/bootdevice/by-name/modem");
I believe installing rom zip updates modem firmware and some other partitions which are not included in TWRP backup and restore. New rom might have new modem firmware that...