In order to achieve this you would need to configure the frontend as shown here with dynamicWidgets.
There's an example code sandbox here where the facet display settings have a category right above category.
Also, see this article for controlling the order of facets in the response: https://support.algolia.com/hc/en-us/articles/9265608786577