However if opening a handle based on pid you may want to double-check that the handle matches your expectation before using it, since that would be prone to the same race.
Unfortunately, it seems like this idea was rejected during the introduction of pidfd.
Edit: note that pidfds holding same-uid processes have no effect (that process already belongs to your uid), and multiple processes holding a single foreign process only count once (that single foreign process is counted toward your NPROC, since it will stick around for pidfd even if its user kills it).
Once the service forks then it becomes a problem. If you use cgroups it can be solved separately with the cgroup freezer, but there are still some open issues with this in systemd: https://github.com/systemd/systemd/issues/13101