Bring rbenv-gem-rehash functionality to core

/cc @sstephenson for review. Should we maybe instead of `rbenv.d/` have `etc/rbenv.d/`, like we expect from rbenv plugins?

Fixes #384