When dealing with detached entities, e.g. with the QueryCache, you cannot use these entities as parameters for other Query.
As $user is detached, the EntityManager does not have its identifier, so Query::_doExecute fails. (There is a "//TODO: Check that $value is MANAGED?" line near the failing line).