LaTeX needs several passes to compile because it was designed with minicomputers of the 80s in mind, i.e. tiny memory constraints.

Latexmk is one way to address this problem. A good IDE like AUCTeX can also figure out how many times the compiler should be invoked.

Good IDEs will also provide other invaluable assistance, like SyncTeX (jumping from source to exact point at PDF, and back).

> LaTeX needs several passes to compile because it was designed with minicomputers of the 80s in mind, i.e. tiny memory constraints.

That's certainly part of it, but any typesetting program will need multiple passes to properly handle tables of contents—you can't know a section's page number until you've compiled everything before that section (including the table of contents), but adding a new section to the contents could push everything ahead by another page. The only unique thing about LaTeX here is that it directly exposes these multiple passes to the user.

As long as it’s deterministic it should be fine. Run the commands in a makefile. Doesn’t sound like the case.