lineageos – I Can’t Get Root Back After Trying To Modify The Hosts File

I have a Motorola Edge (regular not +) running LineageOS 17.1 (20210528). I had it rooted and decided I wanted to use the hosts file for ad blocking. I couldn’t figure out how to get the OS to allow me to modify the host file. While I was doing so, I somehow corrupted to OS and couldn’t boot into it. That was easily fixed by flashing the the OS, but now I can’t get root back. When I reboot after I flash the Magisk patched boot.img (to both partitions), I get “Can’t load Android system. Your data maybe corrupt…” (This happens when I try to boot into both partitions). Before I see the error message, it goes into a bootloop for a few minutes.