The behaviour you are looking for is handled by the refinementList widget in our InstantSearch library. This is what is used in the Algolia dashboard.
When a facet value is selected by the user, the widget makes two API requests to Algolia: one with the filter selected and one with no filter requiring only the facet where a value has been selected to retrieve the other facet values.
You can definitely rebuild this functionality on your custom implementation. To implement this behaviour and avoid increasing the number of requests, you need to make use of the Multiple Queries method: https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=php
You can then combine all your queries into a single multi query request.
We do not provide a guide on how to develop this functionality since the refinementList widget built by our InstantSearch development team handles this behaviour.
However, you can find the source code for instantSearch here: https://github.com/algolia/instantsearch.js/ which is open source and freely viewable as a reference for developing your own functionality.