HHH-8683 EntityEntry backport on master

Hey @gunnarmorling and @sanne
I had to make a few adjustments to port it to master, can you double check it.
(new pull request on the correct repo)
No. If I set deleted state to DEFAULT_DELETED_STATE from a different state, your approach won't erase the previous state.