Knuth wrote it using his novel "literate programming" technique in which the source code is embedded in the documentation. Every 4-5 lines of source code has roughly a paragraph of explanation. That source/documentation is published for anyone to read as Knuth's "TeX: The Program" book, accompanied by his "TeXBook", a couple hundred pages each.
That documentation has definitely encouraged all the people reimplementing the TeX layout algorithms, for example MathJax and matplotlib for math layout, as well as a number of alternative tex implementations.