[hooks] base64-encode extid before inserting it into moved_entities
If we insert the wrong value we're never going to find these entities
again... Closes #5741105.
[hook] remove assumption about entity cache vs cw_edited
We were assuming that if an entity is in the connection's cache, it has
a cw_edited attribute. This doesn't seem to always be the case. At
least in cubicweb 3.21, merging the web and repo-side caches makes this
more likely, but Denis says he's also seen this on 3.20.