Consider this wikitext:
X <ref>This is a '''ref'''</ref> <references/>
The parsed HTML for it is:
<p data-parsoid='{"dsr":[0,32,0,0]}'>X <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{"src":"<ref>This is a '''ref'''</ref>","dsr":[2,32,5,6]}" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid='{\"dsr\":[17,26,3,3]}'>ref</b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"<references/>","dsr":[33,46,2,2]}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> This is a <b>ref</b></li></ol>
The HTML for the <ref> tag is present in the <ol> section. So, we can reduce side of data-mw by having a new property in data-mw for <ref> tags that points to the DOM node (ex: a CSS selector would do the trick).
Doing this properly to completion requires the following:
(a) Identifying fixes to make sure that the HTML is fully identical. In this example above, data-parsoid is missing from the html emitted in the references section.
(b) Proposed change to the spec with an updated data-mw.
(c) Checking in with VE and others to make sure nothing will break with this change.
(d) Creating dependent tasks for clients like VE to fix things on their end and deploy backward compatibility fixes first so that they work with old and new HTML
(e) Deploy Parsoid change.