You probably used the Category List Widget, together with the Layouts Plugin?
The plugin won’t work on Discourse 3.2 or above. But the component code of this Layouts widget has recently been updated to a glimmer component. You could have a look at the code that toggles subcategories and build a standalone category accordion component?
The Discourse Central Theme — Meta Pre-Release Out Now! also features an expendable category list on the sidebar. But it’s only viewable here on meta for now.