The table of contents object returned by the tableofcontents property of SectionUtils is not an actual node of the document, but it is a proxy object that limits the number of levels that you can traverse. The number of levels that you are allowed to traverse is determined by document:toc-depth section of the configuration (see section 2.1.2). Other than the fact that you can only see a certain number of levels of subsections, the object otherwise acts just like any other section node.
In addition to limiting the number of levels of a table of contents, you can also determine whether or not sections that do not generate new files while rendering should appear in the table of contents. By default, only sections that generate a new file while rendering will appear in the table of contents object. If you set the value of document:toc-non-files in the configuration to True, then all sections will appear in the table of contents.