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.
If this is legit nevertheless (it might occasionally happen if the `RichNode` was constructed first, *then* the underlying node was turned into a `Reference`), then you should call
```c++
from.update();
```
instead of this entire `while` loop.