I've taken a closer look at the functions in syntax.el, and I think
you're right. The removal of the syntax-table text properties happens
up to END, not to EOB. It would merely need syntax-propertize-function
to be nil whenever anything involving the CC Mode region (including
fontification) happens.
Is it feasible to support embedded chunks? To support chunks with
incomplete pieces of code (which are e.g. included conditionally by the
surrounding template)?
Well CC Mode already supports preprocessor macros and (for C++) raw
strings, which are syntactically somewhat and very different from the
enclosing code.
I'm not sure it's the same. Like, would CC Mode cope with a region
starting with closing brackets, etc. This might not be a frequent
situation, but at least it shouldn't blow up.
Maybe having several sets of syntax-table text properties in a buffer,
one set for each sub-buffer, would help. I devised and half-implemented
such a facility back in 2017, calling it "indirect text properties". To
switch to a different set of properties, you would merely have to set
(or bind) a dynamic variable.
With this, I could set whitespace syntax-table props all over the non-CC
Mode regions while CC Mode is "in scope", thus making syntactic stuff
and fontification easy.