Allow specifying custom `gem` to use in gem state and module

Better late than never - here is a PR for issue #13202
Merge pull request #17291 from ashb/gem_bin

Allow specifying custom `gem` to use in gem state and module