Making an API request to site.json is the correct way to get a list of categories that includes subcategories. Also, if you want private categories to be returned by the request to site.json, you need to make an authenticated API request.
I’m not seeing any reference to site.json in the docs. SInce categories.json doesn’t return subcategories, the description of the categories route in the docs isn’t correct, it says that the route returns all categories. I will fix that.