Oh, I didn't mean from fastboot. I meant uninstalling them in Magisk Manager before flashing the factory image.I didn't know there was a way to remove Magisk modules from fastboot. How do you do that?
But if you are in a situation where you can't get into your phone due to a magisk mod, you can boot up in safe mode, which will temporarily disable the modules, and then delete them in /data/adb