Query multiple group ancestors at once

This will be a complement to Query multiple group descendants at once.

Provide the ability to perform traversal queries straight off an ActiveRecord::Relation object.

Currently, we can query a single Group which will flip between a linear or recursive algorithm depending on the use_traversal_ids feature flag:

group.self_and_ancestors

Or, we can query an ActiveRecord::Relation object recursively:

Gitlab::ObjectHierarchy.new(owned_groups).base_and_ancestors

This format is a bit cumbersome and not possible for linear queries.

With this MR we can query multiple groups at once easily:

some_groups.self_and_ancestors

Which will flip between linear or recursive based on the use_traversal_ids feature flag.

Along with .self_and_ancestors I've also added .ancestors and .self_and_ancestor_ids.