How to set static DNS with dhclient while resolv.conf keeps getting overwritten?

I think that your DHCP server sends unsolicited responses, so your resolv.conf was overwritten also if you set the supersede parameter. Adding the +i attr may be a solution but requires that you manually unset and re set it if you have to do some changes.

You can, indeed, write some scripts on the client side (see man 8 dhclient-script).

This topic is also explained in debian wiki:

Another approach makes use of dhclient-script's hook scripts. According to dhclient-script(8):

When it starts, the client script first defines a shell function, make_resolv_conf , which is later used to create the /etc/resolv.conf file. To override the default behaviour, redefine this function in the enter hook script. Therefore, we can stop dhclient from overwriting resolv.conf by doing the following:

echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone

The execute bit is required because dhclient-script uses run-parts(8) to decide which files to read. For that same reason, the filename must not contain anything but letters, digits, underscores and hyphens.