[Google Pixel 4 XL ROMs, Kernels, Recoveries, & Oth] SuperITMan:
I retried to apply the same as you but the result is not well... After the install, I receive the message

Can't find valid operating system.
The device will not start.

Visit this link on another device:
g.co/ABH

I did as you proposed. Download the factory image of the Pixel 4 on GrapheneOS website: [h t t p s://]releases.grapheneos.org/flame-factory-2020.09.11.14.zip

Then, I unzipped and copied the "boot.img" file on my phone and I patched it with Magisk.

I zipped the factory image again and used the modified Installation Script.

The install process worked well but the result is not ok :s

./flash-all_first_install.sh
< waiting for any device >
Sending 'bootloader_a' (8801 KB) OKAY [ 0.360s]
Writing 'bootloader_a' (bootloader) Flashing Pack version c2f2-0.2-6374983
(bootloader) Flashing partition table for Lun = 0
(bootloader) Flashing partition table for Lun = 1
(bootloader) Flashing partition table for Lun = 2
(bootloader) Flashing partition table for Lun = 4
(bootloader) Flashing partition table for Lun = 5
(bootloader) Flashing partition xbl_a
(bootloader) Flashing partition xbl_config_a
(bootloader) Flashing partition aop_a
(bootloader) Flashing partition tz_a
(bootloader) Flashing partition hyp_a
(bootloader) Flashing partition abl_a
(bootloader) Flashing partition keymaster_a
(bootloader) Flashing partition devcfg_a
(bootloader) Flashing partition qupfw_a
(bootloader) Flashing partition uefisecapp_a
(bootloader) Flashing partition msadp_a
(bootloader) Flashing partition logfs
OKAY [ 0.266s]
Finished. Total time: 0.849s
Rebooting into bootloader OKAY [ 0.016s]
Finished. Total time: 0.067s
Sending 'radio_a' (82660 KB) OKAY [ 2.310s]
Writing 'radio_a' (bootloader) Flashing Pack version SSD:g8150-00063-200409-B-6382684
(bootloader) Flashing partition modem_a
OKAY [ 0.484s]
Finished. Total time: 3.019s
Rebooting into bootloader OKAY [ 0.020s]
Finished. Total time: 0.070s
--------------------------------------------
Bootloader Version...: c2f2-0.2-6374983
Baseband Version.....: g8150-00063-200409-B-6382684
Serial Number........: 98261FFAZ000M7
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product' OKAY [ 0.069s]
Checking 'version-bootloader' OKAY [ 0.068s]
Checking 'version-baseband' OKAY [ 0.069s]
Setting current slot to 'a' OKAY [ 0.085s]
extracting boot.img (32 MB) to disk... took 0.169s
archive does not contain 'boot.sig'
Sending 'boot_a' (33692 KB) OKAY [ 1.010s]
Writing 'boot_a' OKAY [ 0.209s]
extracting dtbo.img (8 MB) to disk... took 0.029s
archive does not contain 'dtbo.sig'
Sending 'dtbo_a' (8192 KB) OKAY [ 0.340s]
Writing 'dtbo_a' OKAY [ 0.104s]
archive does not contain 'dt.img'
archive does not contain 'recovery.img'
extracting vbmeta.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta.sig'
Sending 'vbmeta_a' (4 KB) OKAY [ 0.140s]
Writing 'vbmeta_a' OKAY [ 0.073s]
extracting vbmeta_system.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta_system.sig'
Sending 'vbmeta_system_a' (4 KB) OKAY [ 0.140s]
Writing 'vbmeta_system_a' OKAY [ 0.073s]
archive does not contain 'vendor_boot.img'
extracting super_empty.img (0 MB) to disk... took 0.000s
Rebooting into fastboot OKAY [ 0.070s]
< waiting for any device >
Sending 'super' (4 KB) OKAY [ 0.001s]
Updating super partition OKAY [ 0.018s]
Resizing 'product_a' OKAY [ 0.004s]
Resizing 'system_a' OKAY [ 0.003s]
Resizing 'system_b' OKAY [ 0.006s]
Resizing 'vendor_a' OKAY [ 0.003s]
Resizing 'vendor_b' OKAY [ 0.003s]
archive does not contain 'boot_other.img'
archive does not contain 'odm.img'
extracting product.img (530 MB) to disk... took 2.270s
archive does not contain 'product.sig'
Resizing 'product_a' OKAY [ 0.005s]
Sending sparse 'product_a' 1/2 (524068 KB) OKAY [ 14.001s]
Writing 'product_a' OKAY [ 2.867s]
Sending sparse 'product_a' 2/2 (19420 KB) OKAY [ 0.526s]
Writing 'product_a' OKAY [ 0.395s]
extracting system.img (946 MB) to disk... took 3.780s
archive does not contain 'system.sig'
Resizing 'system_a' OKAY [ 0.006s]
Sending sparse 'system_a' 1/2 (524284 KB) OKAY [ 14.296s]
Writing 'system_a' OKAY [ 2.966s]
Sending sparse 'system_a' 2/2 (444596 KB) OKAY [ 12.072s]
Writing 'system_a' OKAY [ 2.608s]
archive does not contain 'system_ext.img'
archive does not contain 'system_other.img'
extracting vendor.img (708 MB) to disk... took 2.844s
archive does not contain 'vendor.sig'
Resizing 'vendor_a' OKAY [ 0.006s]
Sending sparse 'vendor_a' 1/2 (524284 KB) OKAY [ 14.204s]
Writing 'vendor_a' OKAY [ 2.895s]
Sending sparse 'vendor_a' 2/2 (200712 KB) OKAY [ 5.450s]
Writing 'vendor_a' OKAY [ 1.410s]
archive does not contain 'vendor_other.img'
Erasing 'userdata' OKAY [ 3.665s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata' OKAY [ 0.007s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Finished. Total time: 106.788s
Rebooting into bootloader OKAY [ 0.002s]
Finished. Total time: 0.052s

I guess I'm doing something wrong... Would you have any idea about how could I solve this ? :)

Thanks for your help!