Fix bug with PackWithReplacements when replacing top-level object with complex values.

Basically, make this work:

```
A = {NewCell 1}
_ = {PackWithReplacments A [A#(a(b))]}
```

Current it fails with "Resources found during pickling", because a Reference is generated during replacement, and pickle.cc was not handling this.
That should *not* be necessary. `RichNode`s are supposed to follow reference chains transparently when they are created. This is a horrible patch to an earlier problem. The earlier problem should be identified and fixed instead.