(#21264) Update rgen dependency to 0.6.5

There is an error in rgen < 0.6.5 that causes it to incorrectly handle
Array#to_str via its monkey patching of Array#method_missing. This adds a
check for this incorrect behavior and updated our Gemfile dependency on
rgen. The package dependencies are already specified in a manner that will
pick up 0.6.5 once it is packaged.

See GH-1713 for a previous patch before rgen contained the fix.