Bugfix: fixed inheritance breaks filtering if relations are included

The problem was a missing check in DataQuery::applyRelation()
Fix #3610 and probably #3528 and #3556