The easy answer is, “as long as it takes”. It’s also the most frustrating one. It may help to think of writing as… well, something like cooking.
There is a difference between successfully making a recipe and cooking a meal. To make any one recipe, you need the recipe, the ingredients in the recipe, the knowledge of the techniques needed to cook said ingredients, and the tools to put it all together – spoons, measuring cups, ovens, etc. Some can be substituted, some can be improvised (a regular teaspoon is a fair substitute for a measuring one in plenty of recipes, especially if you use it consistently), but you need them all.
For a meal, though, you need be able to handle multiple recipes. Even if one of them is as simple as “wash greens to throw together salad to go with roast”. (Meaning you need to know what greens will taste good with said roast.) On top of that, you need to have a sense of how much time it takes to handle your ingredients and how long each recipe will need to finish – which will not be the same length of time as it would be if you were doing any individual recipe.
Take tacos, for example. You need the taco meat, the taco sauce, and all the fixings. In my experience the meat takes at least twenty minutes to cook (more if frozen), and then twenty more to cook in the seasonings. Taco sauce, on the other hand, takes however long is needed to get three cups of water boiling plus about 35 minutes of mixing ingredients and simmering. The taco sauce recipe also makes a lot of sauce, while the taco meat one does a meal plus some leftovers. It can be easiest to make the sauce at a different time, freeze it, and then just thaw out a small amount for each batch of tacos.
If you need to do both at once, in a limited timeframe – say, getting dinner made before it’s way too late at night – then you need to start the meat first. Then the water for the sauce. While the one is cooking and the other heating to a boil, you can assemble the spice mixes for each, and start on getting all the toppings chopped. In my experience the meat is mostly cooked by the time the water boils, and you’ll also have the tomatoes diced. (I start with the tomatoes, because spare juice can be added to the taco meat.) So it’s toss in and stir the sauce spices and paste, while the meat finishes cooking, then the sauce simmers while you drain the meat and add its tomatoes and spices. Both finish cooking while you chop lettuce, cheese, toast shells, and anything else.
But this takes practice. And knowing roughly how long it takes you to chop, dice, mix, etc. Different stoves and ovens have their own quirks, too.
So. Are you writing a story where you already know the world, characters, and setting? If so, it’s like a recipe you’re an old hand at. It’ll be easier to improvise, faster to write, and you’ll already have an idea how long it takes and what goes well with it. Or are you putting together a new world from scratch and the vague shreds of an idea, and need to do research to pull the setting together? Then it’s more like trying to juggle a few never-before-tried recipes. You may not have all the ingredients to start, you’re going to make some mistakes putting them together, and you may have to try a few different recipe combos before you have a great-tasting meal.
…And yes, it takes as long as it takes. But the more you do it, the faster you get!