(#22229) Provide way of getting the container

The catalog tracks the relationship between the container and the
contained resource but did not provide any clear way to query for the
containment information. This adds a new method #container_of(resource)
that will return the container of the given resource, when one exists.
This removes some duplication around understanding what the container
is.