How does the layer know which the relevant sections are? At some point you have to tell it which sections you want a table of contents for. To be pedantic, it doesn't really have a different interface. It's just that the build method for  other layers don't take in any extra arguments. 

One way around this would be to generate a table of contents whenever we can (it's not the layer generator's job to down select). I feel like this is not what pre-process should do. Your mileage may vary.