Fix copying of the correct cache when cloning a layer
The paint device's cache should be connected to the new device, during the paint operation, not to the old one.
BUG:387698