Possible script-edited etymology formats.

Option 1: Template calling template calling template...

Entry code

 {{ETYM|lang|<=123456|>=789123}}

ETYM

{{#if:{{{<|}}}|{{ETYM/{{{<|}}}|1=<}}}}'''{{PAGENAME}}'''{{#if:{{{>|}}}|{{ETYM/{{{>|}}}|1=>}}}}

ID template

{{FROM|{{{1}}}|lang|word|dword|ID|lang|word|dword|ID}}

FROM

{{#ifeq:{{{1}}}|<|{{#if:{{{5}}}|{{ETYM/{{{5}}}|<}}}}{{l|{{{2}}}|{{{3}}}|{{{4}}}}}, from |
{{#if:{{{9}}}|, from {{l|{{{2}}}|{{{3}}}|{{{4}}}}}{{ETYM/{{{9}}}|>}}}}


Option 2: Huge templates holding the full tree, autoupdated regularly.

{{From|123456
|<=lang/word/dword
|<<=lang/word/dword
|<<c<=lang1/word1/dword1/lang2/word2/dword2
|<<c1<=lang/word/dword
|<<c2<=lang/word/dword
|>1=lang/word/dword
|>2=lang/word/dword}}

Option 3: Strings of templates, parsed and figured out, and rematched together and autoupdated.

{{From|lang|word}} {{from|lang|word}} {{from|lang|word}}. ({{descendant|lang|word}})

Well that's a mess...