Sorry about this problem. An outage is definitely a bad thing.
Let’s unpack this into a few topics and see what options are available.
unattended-upgrades
It can be configured to not apply certain updates, and perhaps for your use case, glibc should be in that list. The documentation is at https://documentation.ubuntu.com/server/how-to/software/automatic-updates/
needrestart
I found this discourse post, linked from the README.Ubuntu file in the package: `needrestart` changes in Ubuntu 24.04: service restarts. This talks about the change in behavior introduced in 24.04 about automatic service restarts.
In particular, this talks about how to configure it to prevent restarting single services: `needrestart` changes in Ubuntu 24.04: service restarts
nginx
Perhaps it could treat an unresolvable name as a non-fatal error in its configuration check? But maybe in your case, if the name, at that time, is indeed unresolvable, then it would fail to start for real.
Bugs
In the end, regardless of the reason, what happened is that your service failed while an update was being applied. Maybe the less intrusive fix would be to not attempt restarts after a glibc security update, or block glibc from getting automatic security updates. There are pros and cons. An outage is definitely a con, but we also have to think about the generic case in Ubuntu.
Perhaps file a bug against glibc, since its update is what started this all, and the developers can go from there to see what’s the best way to handle this scenario in a generic way.
For your specific case, I suggest, for now, to investigate the alternatives I listed above, particularly in unattended-upgrades and needrestart configuration options.