> Let's consider the example of TeX

OK, let's. Vanilla TeX doesn't support Unicode or OpenType. Thus we have the “modern” engines XeTeX and LuaTeX. XeTeX natively reads UTF-8 encoded Unicode input and uses HarfBuzz for OpenType. LuaTeX provides a Lua-based API and TeX primitives for multilingual typesetting. Additional custom behaviors can be created using TeX and Lua code or via plugins written in C/C++.

https://www.overleaf.com/learn/latex/Articles/Unicode

Haha I spent so long 3 weeks ago finding a font that would work on XeLaTeX to generate business documents programmatically

not a fun endeavor. Yak-shaving at its best (worst?)

Really? Should work with any OpenType font. Are you generating in a language that doesn't use roman-ish alphabet? You're not wrong that working with TeX can involve a lot of yak shaving in general. Sometimes finding the right template can solve a lot of problems. I use Eisvogel. https://github.com/Wandmalfarbe/pandoc-latex-template