But formally you can enable and make it persistent without unlocking bootloader and rooting.
Why "formally"? Because you will actually need to unlock and root during the process, but then you can relock your bootloader and forget about it until you will wipe your /data. Yes, Camera2 API will remain enabled after relocking and will persist even after OTA updates.
1. If you already didn't, unlock the bootloader and root your phone by Magisk using this guide.
2. Enable ADB in the developer settings.
3. Assuming you already have platform-tools binaries, do this in your shell/cmd:
Now, when you are in the root shell, type this:
setprop persist.camera.HAL3.enabled 1
5. Go to Magisk manager and completely uninstall Magisk here.
6. Reboot and make sure that your system boots properly.
7. Reboot to bootloader:
fastboot oem lock
THIS DOESN'T TOUCH SYSTEM FILES AT ALL AND HAS NOTHING TO DO WITH BUILD.PROP