Everything is done in advance of when it will be needed.
Right from the start you pause the game and designate trees for cutting, plants for gathering, mine out a small spaces for living area's, sleeping quarters, farming grounds, etc. From there you just keep expending to cover what you will be needing for whatever industry you want to support for trade. And you can't forget about defenses while all this is happening, you need to build training rooms and equipment, recruit dwarfs and train them, find metals and smelt them to start producing better equipment. Also don't forget about building and placing traps everywhere, post guard animals, build secret entries, and death grinders for the eventual siege.
And then theres the mega projects you can do, like bringing down the entire mountain, building magma cannons and flooding the world with it, and all the good stuff from the HFS.