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.