These are the result of VE leaving behind nowiki spans in edited content.
See T58381 and the WIP: https://gerrit.wikimedia.org/r/#/c/232313/
But that strategy is still a ways off. For now, add a scrub like,
Simply stripping /(<nowiki \/>)*$/ from serialized wikitext?