[Google Pixel 3 XL ROMs, Kernels, Recoveries, & Oth] Freak07:
thanks [MENTION=4487388]jcmm11[/MENTION] :) that´s one nice way to do it.

most easiest way is to just extract the boot.img from the new factory image, patch the boot.img after flashing the update with -w removed (disable all magisk modules before flashing the update and make sure to redownload modules that are dependant on updates for each security update), flash the patched boot.img and be golden. Although that´s not what you asked for, because you need to repatch the boot.img

Another way is to follow the guide from here:

https://xdaforums.com/pixel-4-xl/how-to/guide-update-retain-root-t4003839

This is probably the most elegant way and you take full advantage of A/B mechanism and Magisk by doing it this way.

It´s for the Pixel 4, but should work for the Pixel 3 too, if you´re stock images got backed up correctly. :)

Let me do some comments to some steps so you know what´s happening there, maybe it helps other people too.

1. Disable any desired Magisk modules, ex. Edxposed (I usually disable all modules just to be safe)

2. Reboot

3. In Magisk, select Uninstall, press Restore Images

This will restore back the stock boot.img and dtbo.img to your current slot, before you flashed Magisk, or patched your boot.img. Google checks for the original images before flashing the OTA. So flashing an OTA does not work on devices, with a custom kernel because the system detects that a different boot and dtbo.img is present. As you know by now, flashing my kernel alters both, the boot.img and the dtbo.img as well.

If you ever wondered about the text "backing up stock boot images" while you patched the boot.img, now you know one reason they get backed up in the first place.

4. Do NOT Reboot

If you do a reboot now, you will lose root, which is needed for step number 8, as you just, restored the backed up stock kernel that is not patched with magisk. Doing a reboot would result in running the stock kernel, without the "Magisk Patch".

5. Install OTA Update via Settings -> System -> System Updates

Installing an update via OTA, will always flash the update to the other slot you are currently not running (inactive slot) and on the following reboot switch to that slot automatically! Flashing a factory image with fastboot, will keep the current slot! It´s important to know this.

6. When prompted to reboot, Do NOT Reboot

This is again important, otherwise you would lose root, which is needed for step 8. Just like in step 4, except for you would now be on the updated slot with new firmware, (since you flashed the OTA) but without root by magisk.

7. In Magisk Manager press Install

8. Select Install to Inactive Slot

What happens now is the beauty of A/B. As an exmaple let´s say you´re currently on Slot A. In step 5 the OTA, with the update firmware got flashed to Slot B, which is still inactive, but already ready to be used as soon as you reboot. Magisk detects now you´re still on Slot A, but install itself to the inactive Slot B, which holds the updated firmware ready for the next reboot. That´s why magisk emphasizes it will not boot to the inactive slot, which should happen only after you installed an OTA.

9. Reboot

Congratulations, if everything went fine you successfully booted to the previously inactive Slot (B in our example) which holds the updated firmware plus root via Magisk.