The original code may fail on permission deny if it's called by a process that just enters a new pid namespace but before the procfs is remounted. Changing to use /proc/self fixes it because the magic symlink always points to the right pid directory regardless of the process's current pid namespace.
For example, to create a container, we may want to have the init process enter some new namespaces like pid and mount, and remount procfs. Say its host pid is 10000 and container pid is 1. It may see the procfs from the host for a short period of time while getpid() returns 1. If openmp is used during that period, it will access /proc/1 and get permission deny. Using /proc/self works before (points to /proc/10000) and after (to /proc/1) remounting procfs.
There is no strong requirement to use openmp before procfs is remounted, but it's good to cover more edge cases without compromising common cases.
You might want to keep the existing getpid()-based version on HURD.
I'm not familiar enough with HURD, but based on the commit that added /proc/self - it seems to be an optional compat option and might not always be configured:
https://git.savannah.gnu.org/cgit/hurd/procfs.git/commit/?id=4665f087fde174a9de3e1c3f3de090dd4bfa85e0
https://www.gnu.org/software/hurd/hurd/translator/procfs/jkoenig/discussion.html