Parsoid doesn't add section edit links around HTML-syntax headings, and shortly (T417530) won't add <section> wrappers around HTML-syntax heading either.
For compatibility with the legacy parser we currently use the same heuristic which the legacy parser does: the presence of "extra" attributes on the <hX> tag. However Parsoid has precise information about the tag syntax in the data-parsoid, and the legacy parser could be extended to encode precise information as well, eg by adding a placeholder data-mw-wikitext-syntax attribute to headings generated from == ... == syntax.
This should be done after T417530: Parsoid shouldn't wrap wikitext html-ish `<hX>` tags in <section> wrappers if we find that there are significant numbers of "no attribute" html-syntax headings that are generating problematic <section> wrappers.