Fix EZP-23037: multiple JOINs in Subtree criterion

JIRA: https://jira.ez.no/browse/EZP-23037

Problem: 
Subtree criterion is used in content search for user roles/permissions in policy and role assignment subtree limitations.
Given enough limitations, this will cause many JOIN clauses on simple content searches.
Depending on conditions, the above can cause severe performance degradation leading to MySQL timeouts (queries not finishing).

Since it seems there is no actual need for multiple joins, and the where conditions can all be done on the same table, this PR replaces the "unique table name join" with a single join clause on the contentobject_tree table, by looking at the existing aliases in `$query`.
This should really be `$query->selectDistinct( ... )`.