I believe my example is most of the way there, WithExtension appears to parse the block and then append the AST representation of some

{% assign .. %}

nodes into the context of the nodes it is parsing.

So I figured I want the same thing, those assignments, followed by an include block, which I'd expect to be able to access those variables when the AST is parsed, and to pass through the block that was wrapped as a variable

rather than a template name, but I don't really know how to parse in additional nodes for the objective of getting AST rather than string output (i.e. renderings) – nor whether this is the right approach. Am I on the right lines, any ideas on how I should go about this?