Generating the whole TOC automatically is a bit tricky, because there’s not necessarily one ordering that will work for all wikis.
Maybe it’d help to think of it as multiple kinds of lists?
There’s an index, which lists everything alphabetically. Listing every page alphabetically is a bit much for large wikis, but having a way to list all of the wiki pages in a particular category or with a particular tag would go a long way. (And then having an index for when someone really just wants to look at all of the pages.)
There’s also the categories and tags; maybe a master TOC could list the categories, and then the categories could have their own table of contents pages?
Just some suggestions.