The author is not complaining, but pointing out how complicated it is to determine programmatically the number of processes to use, and that most software doesn't take all the different possibilities into account.
Even if it were a complaint, the solution isn't only 'make one yourself' but includes 'write about it and see if someone knows of an existing solution'.
Which is what happened here. A commenter wrote: "I think that hwloc understands as many CPU limits on Linux as feasible, including the cgroups, but it's really overkill for something as small as a build tool. The end result is that a lot of limits must be checked in order to find out how many processes can be used."
That hwloc links to https://www.open-mpi.org/projects/hwloc/ which among other things 'may also help many applications ... find out how many cores and/or hardware threads are available'.