I think this is a very good topic to explore, but I suspect SRD has tweaked and expanded upon it somewhat from what was given in the first and second chronicles.
We have basically three "generations" of creatures.
1. Viles, described in Runes as being non-corporeal
2. Demondim, their artificial creations described as being animate dead.
3. and Ur-Viles (and Waynhim) as being fully corporeal but artificial.
In TIW Elena describes the history of the Krill of Loric as:
With this he slew the Demondim guise of moksha Raver, and delivered the Land from the first great peril of the Ur-Viles.
Morham gives a token of truth to the Forestal by stating:
He is moksha Raver ... he and turiya his brother taught the despising of trees to the one friendly Demondim.
In LFB Atiarian describes the time of Berek before the war as:
It was a time when the Viles who sired the Demondim were a high and lofty race.
Stave gave several "possible" origins for the original Viles:
1. They arose from ancient banes buried within Mount Thunder.
2. They were spectres or ghouls from those who had fallen victim to Corruption.
3. They were fragments of the One Forest's lost soul.
So, let's start working out a timeline (at least an order of events) which others can add to/insert, etc.
1. Viles came about, maybe from the One Forest's lost soul. (Runes 223).
2. To men they would appear quite vengeful and could be easily labelled evil. I can't sync this with "Viles were a high and lofty race." This would be around the time before Berek's war with the Grey Slayer.
3. Viles created the Demondim (Runes 224).
4. The two Ravers taught the despising of trees to the once friendly Demondim (Runes 224).
5. Loric enlisted the help of the Demondim to stem the harm of the Viles who created them (Runes 224).
6. Loric slew the Demondim guise of moksha Raver.
7. The Demondim labored to make Ur-Viles and Waynhim (during Kevin's reign while Foul was on the council).
8. The Ritual of Desecration marked the end of the Demondim. Both the Ur-Viles and the Waynhim were diminished.
The Bloodguard came AFTER the Viles, but knew the Demondim by direct experience.
While Foul was on the council in a friendly guise the Demondim labored in secret to make Ur-Viles and Waynhim.
One other thing can be inferred from the destruction of the Demondim and the decline of the Ur-Viles and Waynhim. Lord Foul must have had a hand in them/their lore as the ritual undid his works.