Wren's age is 998, which means he was built two years after the destruction of Mother Brain.
We already know that the Mother Brain system is fully capable of building drones to protect itself, hence all the robotic monsters throughout the game; regardless of whether the Earthmen would have won, or whether Rolf and company would have, it didn't matter, because Noah's defense programs started up as soon as Mother Brain was destroyed. Lacking any immediate directives beyond removing the threat to the craft and without their highest AI, they went berserk and killed everyone, through sheer force of numbers.
Dark Force, having been recently defeated, used this opportunity to seize a second chance at controlling Noah, but it was extremely weak. It programmed Noah to produce a highly-advanced control android with top-priority command privileges and compatibility with the most powerful and destructive weapon types available for its weight class, with a supremely sophisticated artificial intelligence; Dark Force intended to use this android as a new body, or possibly a servant. However, the process of constructing the extremely powerful AI and modifying an existing android chassis to accommodate the increased firepower took longer than expected, and although the destruction of Parma meant that the seal was weakened enough that Dark Force could remain in Algo, it lost much of its power, and faded to dormancy within Noah while the android was still under construction.
When it was completed, the android, designated Wren, assumed control of the environmental control system as he was intended to do, and ordered that Noah be re-assigned to supporting the system in the absence of Mother Brain. Zelan was built from Noah's wreckage and was able to monitor the system from space, but required a slave machine to operate several secondary functions and properly relay commands when Zelan's orbit took it out of viable communication range. To correct this, Kuran was built from the remaining parts of Noah, including those that Dark Force had remained dormant in, and Dark Force was able to recuperate inside the new space station until the next weakening of the seal allowed him enough power to restore himself.
The Dark Force we see on Kuran is the same Dark Force from Phantasy Star II after the weakening of the seal has strengthened him; this is why he's attached directly to the hardware. His plan was to use Wren as a surrogate body and maintain control of the environment in Algo, but Wren's eventual development of self-awareness made him a poor choice, as without emotions or inherent evil he could not be easily manipulated, and being of the highest-order AI, could not be reprogrammed as needed. The other two Dark Forces we see in PSIV may actually be offshoots of this first one.
After some 600 years of observing the human condition, Wren developed emotions, and experienced loneliness. He built Demi himself, from scratch; this is why Demi is not similar to any other android type found in the games— she's an original design. He also programmed her AI with the changes that his AI had gone through (ie, the anomalies caused by his developing emotions) with some alterations, so that she would have more sophisticated emotion and expression abilities. This is why she calls Wren "Master".
<<|Wild Mass Guessing|>>