As noted in T387374#10587246 and T368095#9971720, Parsoid only sees the flattened wikitext output post- template expansion and so it considers all sections as belonging to the top level template.
Captured by the "Nested section numbering" test added in,
https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/1053075/6/tests/parser/headings.txt