Eh maybe. Is the kernel version the same? Also magisk is not built to be installed this way so it can't work 100%
Even if the exploit can be used only to temporarily have root, it should be possible to modify the devinfo partition and mark the bootloader as unlocked. Unless it's changed on newer models, all devinfo contains is a magic string of text ("ANDROID-BOOT!") and two boolean values that indicate if the bootloader is unlocked. It's generally possible to unlock just by modifying the two bools, AFAIK.