It is not 3 compiles of the same code after another, but e.g. latex, bibtex, latex, with each step creating part of the final output. I imagine latex like part of multi-pass compiler, so calling latex once is like running only one stage of the compiler. Latexmk (https://www.ctan.org/pkg/latexmk) solves this problem more elegantly by knowing how often each tool and in what order is required.
In latex, I have to compile once so that it can find out the references it needs, then bibtex so that it extracts the actual references, compile a second time to get the references into the paper and then a third time because a ton of things shift around and now it knows all the figure/page numbers etc.