No you dont need root to flash, but if you install magisk you need to flash the patched boot image therefore have bootloader unblocked which is needed. What I meant is that if OP decides to root with Magisk it’ll just be easier to install Lineages OS(if his phones are supported) than to search for the firmware file to extract boot image since Lineage offers it already extracted