Sejda PDF is an online and desktop cross platform toolset for editing PDF files.
The Merge PDF tool has an option to create a table of contents based on:
- Names of files being merged
- Titles of documents being merged
It has another 2 features that works nicely combined with generating the TOC:
- Generating top level bookmarks for each merged file (can wrap existing bookmarks)
- Adding the filename/document name to the footer of each merged page (to identify the source document)
Sejda PDF is free to use within limits (3 tasks per day, 50 pages max per merge - not much for a merged document).