Issue #2155713 by rszrama: make a better attempt to determine the base table when doing entity access query alteration similar to node's implementation.