[DDC-2224] Rewrite instanceof feature with parameter needle ClassMetadata breaks caching of queries.