Here is some wikitext where the template target is invalid
{{1x {{1x|foo}} }}
Here is Parsoid's output which is clearly incorrect.
[subbu@earth:~/work/wmf/parsoid] echo -e '{{1x\n{{1x|foo}}\n}}'| php bin/parse.php --normalize=parsoid <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x\n{{1x|foo}}\n"},"params":{},"i":0}}]}'>{{1x foo }}</p>
And, here is the HTML trace which shows the problem
[subbu@earth:~/work/wmf/parsoid] echo -e '{{1x\n{{1x|foo}}\n}}'| php bin/parse.php --trace html |& egrep "^0" 0-[HTML] | {"type":"TagTk","name":"p","attribs":[],"dataAttribs":{"tmp":{"tagId":1}}} 0-[HTML] | {"type":"SelfclosingTagTk","name":"meta","attribs":[{"k":"typeof","v":"mw:Transclusion"},{"k":"about","v":"#mwt2"}],"dataAttribs":{"tsr":[0,18],"src":"{{1x\n{{1x|foo}}\n}}","tmp":{"tplarginfo":"{\"dict\":{\"target\":{\"wt\":\"1x\\n{{1x|foo}}\\n\"},\"params\":{}},\"paramInfos\":[]}","tagId":2}}} 0-[HTML] | "{{" 0-[HTML] | "1x" 0-[HTML] | {"type":"NlTk","dataAttribs":{"tsr":[4,5],"tmp":{"inTransclusion":true}}} 0-[HTML] | "foo" 0-[HTML] | {"type":"NlTk","dataAttribs":{"tsr":[15,16],"tmp":{"inTransclusion":true}}} 0-[HTML] | "}}" 0-[HTML] | {"type":"SelfclosingTagTk","name":"meta","attribs":[{"k":"typeof","v":"mw:Transclusion/End"},{"k":"about","v":"#mwt2"}],"dataAttribs":{"tsr":[null,18],"tmp":{"inTransclusion":true,"tagId":3}}} 0-[HTML] | {"type":"EndTagTk","name":"p","attribs":[],"dataAttribs":{"tmp":{}}} 0-[HTML] | {"type":"NlTk","dataAttribs":{"tsr":[18,19],"tmp":{}}} 0-[HTML] | {"type":"EOFTk"}