To do this, we will need knowledge of which template parameters can be parsed to DOM or other types and which need to remain wikitext. A start tag parameter should probably not be parsed to DOM for example (as a passed-in start tag would be balanced in the process), while most content parameters can. Apart from wikitext string vs. DOM we could also eventually refine parsing further for things like dates, numbers etc. Our DOM spec for templates  is already prepared to represent DOM and other representations of individual parameters.
The main thing that we'll need for the next step is information on where it is safe to do so. This information can come from something like TemplateData or DBPedia.