The DSpace OAI-PMH repository exposes an endpoint /hierarchy for API v6, which provides the logical structure of how communities, sub-communities and collections are related. This is documented at https://wiki.lyrasis.org/pages/viewpage.action?pageId=104566810#RESTAPIv6(deprecated)-Hierarchy
As v6 will be deprecated, is there a direct replacement for this endpoint in v7?
There's no reference to it in the documentation https://wiki.lyrasis.org/display/DSDOC7x/REST+API nor can I see anything equivalent in the live demo: https://api7.dspace.org/server/#/server/api
There is no exact replacement in DSpace 7 REST API. But you can retrieve the same information as follows:
This is how the hierarchy is achieved in the DSpace 7 User Interface when you visit the "/community-list" page, e.g. https://demo7.dspace.org/community-list