This answer contains spoilers for the book The Stars Are Legion.
I've read the entire novel and the question is never answered in depth. What becomes increasingly clear throughout the novel is that the Legion is the remnants of a civilization that was once much more scientifically/technologically advanced than the Legion is when the novel takes place. The characters have amazing tech, but no one seems clear on how any of it works beyond purely mechanical "put cog here" type of stuff. The only people who have any sort of understanding of how the ships work are "the witches" and they are insane.
There is also this line near the end of the book which shows that the organic "world" of the Moshki (and probably the other worlds) were constructed over metal skeletons:
"The world here is much worse off than the Katazyrna. The flesh has
peeled back from all the walls to reveal rusted-out metal, twisted
wiring, shriveled tendons. What really makes up the core of every
world? Metal skeletons? Fashioned by whom? The gods? Did a god truly
come all the way out here and shit out the Legion itself and fly on
across the universe, or have we been here all along?"
This strongly suggests that the worlds were actually man made (although Zan doesn't seem to understand this).
The women produce "what the world needs" as you said -- and this includes children. It seems like most women do not birth children, but rather other parts for the ship. Sex is seemingly not needed for reproduction, but -- and this is important -- the women still experience sexual desire and they have sex with one another. The reason this is important is that it suggests that these people used to reproduce sexually. There is no need for a species that has always reproduced asexually to have a sex drive.
Therefore, I think the most likely answer is that some advanced civilization of humans wanted to create self-sustaining spaceships and they figured out a way for the ship itself to produce whatever it needs, partly by having the women occupants "birth" parts and children. The ship itself gets the women pregnant. The technicalities of how this works are not explained whatsoever. Jayd gets "treatments" prior to her pregnancies, but it is pretty clear that this isn't required to get pregnant. In fact, the people on the lower levels seem to expect women to just spontaneously turn up pregnant at more or less regular intervals. Zan's companions from the lower levels express surprise that she doesn't become pregnant like the rest of them during their long journey and once she thinks on it, Zan seems to agree with them.