(FACT-640) Cherry-pick lost gid fact back into master

This commit cherry-picks the gid fact back into master,
which was lost during the facter-2 / master merge.

Original commit (abb477df):
(#22143) Add 'gid' fact to resolve users primary group.
A very simple fact to fetch the primary group.  I've only tested
this on Linux/OSX/FreeBSD but id -ng seems to be global.  I even
got a user to test it on Hurd and it worked.