(#22943) Add a spec test to reproduce the failure
(#22943) Remove 2 def_delegator's in favor of explicit method invocations.
(#22943) Add catalog to resources only after the catalog is complete.

This is the essence of the fix for #22943.  The issue there is that
Debian user or group resources end up with an incomplete containment
path, leading to inconsistent reporting, etc.

Background:
The containment path at issue here is returned from Puppet::Type#path method,
which calls Puppet::Type#pathbuilder, which calls Puppet::Type#parent.
And that parent method memoizes its return in the @parent member variable.
The three things to note re the parent method are that the existence check is
'unless defined?(@parent)', that it generates the parent from the catalog,
and that if the resource has no catalog, it returns (but does *not* memoize) nil.

Problem:
During the execution of to_ral the catalog that the resource sees is
under construction. So if the first invocation of path and thus parenti
is during to_ral the resource may memoize nil as the value of parent.
Since the memoization check uses defined?, subsequent calls to parent
consider nil to be a satisfactory answer and won't rerun the logic.

(Btw, Debian is mostly an innocent bystander: the reason that this
happens specifically to Debian-family user resources is that the newattr
code ends up emitting a debug message, and debug for a resource ends up
invoking Puppet::Util::Logging#log_source which calls path, which memoizes
@parent as nil, effectively disabling future attempts to read the correct
containment path.

Fix:
The fix is in to_catalog: don't add the catalog to the resources until
the catalog is complete.  This avoids the access to a catalog under construction
that triggers this issue.
(maint) Fix typo in a comment.
(#22943) Refactor/rename Puppet::Resource#to_resource

* Promote Puppet::Parser::Resource#to_resource to the
  parent class, Puppet::Resource
* Cleanup in Puppet::Resource::Catalog#to_catalog:
** It was using dup to copy the resource, then (for this
   issue) needing to nil-out the catalog.  Now just
   use copy_as_resource
** The conditional around which convert method to use
   was more flexible (and thus confusing) than it needed
   to be.  Distilled to the two cases: to_resource vs to_ral
* Rename to_resource to copy_as_resource for clarity.
  This required updating a number of unit tests.
(Maint) Remove unused required lib

The Forwardable functionality isn't used in the Puppet::Parser::Resource
anymore and so it does not need to require forwardable.
Merge branch 'kylog-issue/master/22943-debian-user-resource-wrong-path'

* kylog-issue/master/22943-debian-user-resource-wrong-path:
  (Maint) Remove unused required lib
  (#22943) Refactor/rename Puppet::Resource#to_resource
  (maint) Fix typo in a comment.
  (#22943) Add catalog to resources only after the catalog is complete.
  (#22943) Remove 2 def_delegator's in favor of explicit method invocations.
  (#22943) Add a spec test to reproduce the failure