Fixes a bug with :tocdepth: and inventory generation

Setting a non-zero :tocdepth: in a document prematurely halts processing of tables of contents in that document in sections at depths greater/equal to :tocdepth:. Instead, all tables of contents should be processed regardless of :tocdepth:, which should only control the presentation of the TOC for that page. This results in deceptive warnings like:

astropy/docs/changelog.rst:: WARNING: document isn't included in any toctree

which otherwise don't show up without the :tocdepth: option. I'd be happy to add a regression test too if you can tell me where it should go.