@ssastry write,
Fostered content is such a pain and source of complexity in the codebase. So much can be simplified without having to deal with that. Unfortunately, there is no easy solution to preventing wikitext from being saved that has this error.
Alternatively, if there is a way to mark pages with fostered content uneditable in VE (by wrapping the entire page in a mw:Placeholder for example), we could kill some amount of code complexity in the codebase. We probably need some stats on the prevalence of this error, and more aggressively have wikis fix this lint error.
https://tools.wmflabs.org/fireflytools/linter/enwiki says 4924 errors in the article namespace .. so, a non-trivial number.
But, we should at least formally and publicly entertain this idea and get feedback for this approach.
From the review comments in,
https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/469355/