this had regressed in 5f1e405 – if an entity had two or more parent relations, the loop would abort after the first parent relation because `memo[entity.id]` would be set to true in the first parent iteration. what we want is to only abort if the same `relation` is seen again (in a r123 [-> …] -> r123 cirular relationship)
Since d5e427289, the tree head graph will not update if only tags have
changed - it requires an addition, deletion, or geometry change.
This makes the tree a little more efficient, but we do need to make
sure to return the current entities to the caller.