You got it all wrong.
You need to install the custom ROM + the GApps package in one go without rebooting to system in between so it gets granted some privilege permissions and required hooks.
You can install Magisk later at any time so keep the first boot simple by eliminating that variable.
Check the thread where you found that ROM for installation tips & recommended recovery version.
Note that on A/B partitions devices you need to reboot to recovery to change the active slot after flashing the ROM & before flashing the Gapps package.