This problem could get very complicated if more than one building can die at a time. I think I'd do something like this. First you'll need variables:
Builders = unit [array size 10]
//this is a unit array. You put your builders in here when they are given an order to build a structure. The number in the array corresponds to the spot and structure type (see below).
BuildSpots = point [array size 10]
//this is a point array. It stores the location of all new buildings that you have ordered.
BuildStructureType = unit-type [array size 10]
//this is a unit-type array. It stores the type of structure that you've ordered to be built.
CurrentBuilder = unit group
//this is a unit group that stores all peasants that are currently being ordered to build a structure
BuildCounter = integer
//this is a temporary integer variable
You'll need triggers for these situations:
1. Structure dies
When this happens, go through all 10 BuildUnits until you find an empty spot. For each integer A do... if BuildUnit[A] = no unit, then set BuildCounter = A. If you do that, BuildCounter will store a number from 1-10 that is empty. Then assign BuildUnit[BuildCounter] = random peasant not in CurrentBuilder. Then store BuildSpots = position of dying structure. Then store BuildStructureType = unit-type of dying unit.
2. Repeat trigger - periodic trigger (every .75 seconds or so)
For each Integer B do...if BuildUnit = no unit equal to false, then order BuildUnit to build BuildStructure at BuildSpots.
3. Peasant starts construction
Remove unit from CurrentBuilder. For each integer A do... if BuildUnit[A] = triggering unit, then set BuildUnit[A] = no unit.
That set up should do nicely, though there will be problems if a peasant is killed while building a building.