I've got a patchset that makes coredump install a pidfd for the coredumping task into the file descriptor of the process that is exec'd as a usermode helper during a pipe-based coredump. For example, systemd-coredump could set:
|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %F
and %F will make the kernel install a pidfd as file descriptor number 3 for the coredumping task.
Barebones, untested, no commit messages yet:
https://web.git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=work.coredump
Useful?