This look like specific to h3 tag, code like <h3 id="{{{1}}}">{{{1}}}</h3> in a template will duplicate a ref if {{{1}}} contains one. If I replace h3 by a span the ref is no longer duplicated
see https://fr.wikisource.org/wiki/Utilisateur:Phe/Test15 and https://fr.wikisource.org/wiki/Utilisateur:Phe/Test16
User reporting this trouble said it was working in the past.