Internal utility for building trees of resource relationships
@spec get_base_relationships(tuple()) :: term()
@spec member_of_tree?(term(), term()) :: boolean()
@spec put_as_tree(term(), term(), term()) :: term()