Doy you mean about this?
Steps 1-4 can be done in Qubes Global Config.
Step 5 should be done by creating a systemd service in the sys-net and sys-firewall template that will be run before network-pre.target and it’ll run a script that’ll configure output firewall rules for qubes with the name “sys-net” and “sys-firewall”.
You can check the name of the qube inside the script using hostname command.
The firewall rules should be something like this:
nft add chain ip qubes output '{ type filter hook output priority 0; policy accept; }'
nft add rule ip qubes output oifname "lo" accept
nft add rule ip qubes output drop
nft add chain ip6 qubes output '{ type filter hook output priority 0; policy accept; }'
nft add rule ip6 qubes output oifname "lo" accept
nft add rule ip6 qubes output drop