The workaround, which isn't really a workaround at all because it's the standard way of doing this (plus a fairly modest common extension that we terminal emulator authors have mostly agreed upon), has already been found. The Microsoft people in the GitHub issue said to use ED 2 and ED 3, as well.
I merely additionally explained why your doing something that they did not suggest is wrong, not only for the reasons that the Microsoft people already said, but for the additional reasons that it has a standard function that is not what is desired here.
It doesn't work, though, as I've already explained elsewhere in the comment tree. It works in naive examples, but fails to clear at the correct time in more complex situations.
I merely additionally explained why your doing something that they did not suggest is wrong, not only for the reasons that the Microsoft people already said, but for the additional reasons that it has a standard function that is not what is desired here.