All of this. However, the issue is that coding the paper is only _one_ (and often not the biggest) step from idea to published paper. Worse, once the paper is published typically nobody cares for your code and whether its test coverage is x% (at least here in the social sciences).
I'm not saying that I support this (quite the opposite), but that's the outcome of our publish-fast-and-frequently-culture to get tenure.
Nota bene, I observe an increasing number of exceptions to this rule in my field, but still a minority.
Wireguard comes with an example script [1] that does DNS updates for peers, which works well for me in a cron job. Archwiki also has an example for systemd timers [2]. But if your question is specifically about phones, then this might get a bit more complicated to set up.
Cheers all you selfhosted-FOSS-alternatives! Time to bump up those Patreon contributions...