Try this:
https://www.dokuwiki.org/plugin:tocselect
I wrote it a few years ago so can't remember it in detail but just briefly looking over the plugin page, I think it will work.
It's this type of listing that you would want:
https://www.dokuwiki.org/plugin:tocselect#table_of_contents_listings
The syntax for that is:
https://www.dokuwiki.org/plugin:tocselect#auto-selection_of_current_page_id