[This has been mooted numerous times in many different ways, hopefully this task can start to collect and organize some of them in addition to proposing a specific solution.]
Many different groups want to extract semantic information from templates, and some efforts have already been done to encode this with wikidata, eg CiteQ in T289287: Add support for the 'Cite Q' template to Citoid, T69659: TemplateData should have a parameter to support Wikidata, information about [[en:Template:Citation]] in https://www.wikidata.org/wiki/Q6925554 etc.
At present, groups such as research, mobile, VE/Citoid, Content Translation, etc use large hand-assembled lists of “what is the template on wiki X which corresponds to wiki Y” or “what are the infobox templates on wiki X” etc. This would provide a uniform mechanism to encode this information.
This has been proposed as a useful infrastructure feature numerous time, but like other cross-team proposals would benefit from being done initially in conjunction with a specific client team.