Incrementally.
The first computers were made in discrete parts. At first vacuum tubes, then transistors. Then the first integrated circuits that had only a couple dozen transistors and were based on manually projected stencils. The computers would help a bit, but most of the work was done with pen on paper. What is now done by a single tiny chip was occupying a large board with a hundred integrated circuits - each designed by hand. Never mind precision of the process wouldn't allow more elements in an IC.
At certain point, computers were advanced enough to implement CAD software. This allowed moving the design from paper to circuitry, applying common cut&paste to stuff several chips into one, then plot a large, complex mask on paper to be shrunk by photo-techniques and made into more complex chips. As these entered use, increasingly less of the process was done "by hand" and increasingly more was automated. Specialized software that allowed use of a high-level programming language to "write" the IC architecture, that compiled to paths and transistors without human interaction, robotic assembly lines that could prepare increasingly more complex masks etc.
Think of it that way: you think the mask can't be made using anything less than it produces... are you sure? Can't it be made using something 5% less than it produces? And that one can't be made with something another 5% less complex?