From an email thread with Subbu & C.Scott:

Subbu writes:

Gabriel and I started discussing this the week before he headed out on vacation ... we'll continue once he is back ... we might either have to hack or use other tricks to support these templates.  A bot pass (https://bugzilla.wikimedia.org/show_bug.cgi?id=50547) is one idea we've considered (first fix up the templates, and then use a bot to go and fix pages that use the templates).

---
I asked:

If we wanted to improve the markup of these templates so they can be more sanely parsed, what instructions would we provide?

---
Subbu responds:

Instead of generating just style attributes of a table cell, make the "|" char part of the template.  So, the templates should produce a styled-cell rather than just the cell-style. And, that also means that the pages that use these should not have "|" char before the transclusion -- but we may be able to work around by recognizing that pattern (I say that without working through the details).

So, instead of (old wikitext):
{|
| {{yes}}
|}

they would have to code this as:
{|
{{yes}}
|}

Looks like there are quite a few of these here: https://en.wikipedia.org/wiki/Template:Table_cell_templates  I haven't investigated all the various ways these templates are used, but at first pass, I think that approach should fix the problem.

---

C.Scott responds:

It's probably worth bringing the VE team into this discussion.  I
think that VE would probably struggle trying to edit table cell(s)
generated with a template containing a style + cell contents in this
fashion and/or have difficulty processing whatever markup we decide
Parsoid "should" generate for this case.  My intuition is that fixing
the templates to include the leading vertical bar, so that the
template is clearly a cell, not part-of-a-cell, is a better long-term
solution for editing (Parsoid+VE).  It seems like a bot to make this
change could be implemented + deployed relatively quickly, although I
haven't actually written a bot before, maybe there are community or
other factors limiting the speed at which bot edits are made?
 --scott
ps. who'd be interested in writing said bot, because he's never done
that before, although I suspect it would be best farmed off to someone
who's done this sort of thing before.

And also adds:

Note that there are some anomalous usages, for example:

! {{yes}}
| rowspan=2 {{n/a}}

The first case would have to be {{yes|type=header}} and the second
something like {{n/a|rowspan=2}}, both with additional changes to the
table cell template.  In other words, the issue isn't just that the
style and cell content boundary is spanned, it's that some of the
style comes from outside the template and some comes from inside.

I still think a bot might be the best long-term fix, but it's not
entirely straightforward.  If we were to fix it inside parsoid, we'd
have to introduce something like an "open style context", probably
buffering the style information and spitting it out only after we've
seen the style context closed.  It would still be an "interesting"
editing challenge in VE -- some of the table style information would
be editable, some would come from the template (and be editable only
inside the template editor?).
 --scott