We should rely on HeadingPFragment to set the index when inTemplate to avoid this issue
- Include directives on a line (T384490#10731504)
- Parser functions returning wikitext (T387520#10985986)
- Modules (T387521#12060718)
The headings are ultimately generated from Module:Article_stub_box and so there's no template source to associate them with