Or, if you're a lazy f, just recreate the file with your desired contents and then do
chattr +i /etc/resolv.conf
To make it immutable. chattr +i /etc/resolv.conf
To make it immutable.Also I'm not necessarily saying it's a good or a bad solution. But it works, so there's that.
It relies on /etc/resolv.conf being a symbolic link to it's generated version in /run/systemd/resolve/resolv.conf to do its thing. If it isn't linked, it assumes that is intentional and leaves your resolv.conf alone.