sadly, this was only really possible in Type 3 fonts which were basically 100% postscript interpreted at the glyph level. this made it possible to do things like actually generate a new instance of a glyph each time it was printed at the expense of printing being incredibly costly. If you find interviews where people talk about using beowulf, they all remark how it basically put their printers' cpus to actual work and that files would take forever to output.
opentype only allows for simple substitutions, but in many cases, those seem to do the trick if you programmatically generate a substitution map based on a target language's corpus. i think there's a robofont or typecon session where they talk about this and the practical limitations of how many gsubs most opentype engines can deal with before they stop altogether. very cool stuff and mega-niche, but it's cool to see how people play with constraints.