In the query pipeilne, we pattern match specific LINQ operators to translate to specialized functions/operators. For example, on SQLite, the query fragment Where(b => b.Ints.Count() == 8) is translated to json_array_length(b.Ints) = 8, rather than the full subquery translation (SELECT COUNT(*) FROM json_each(b.Ints)) == 8).
Unfortunately, in many of the sites where this sort of pattern matching occurs, I left out checking the predicate. As a result, we perform these simplifications even when we shouldn't. For example, Where(b => b.Ints.Where(i => i > 3).Count() == 8) also translates to json_array_length(b.Ints) = 8, effectively ignoring the Where().
Corresponding issue for PG: npgsql/efcore.pg#3195