Never mind this thread - it seems that such an extension already exists: http://meta.wikimedia.org/wiki/VariablesExtension seems to be exactly what I wanted! (I haven't tested it yet, but it seems perfect.)
This find again proves how important it is to know the right keyword(s) to search for...
Apologies for having bothered you all with this.
-- F.