I think a major part of improved sieges would be a comprehensive morale system. As it stands, dwarves (or anything else) either run away never, or run away after a certain number of casualties, and it's always en-masse. It wouldn't eat many FPS to have the game check individual happiness levels and apply short term modifiers to this. If friends are dying all around, most people would fall back to another position or just plain run away, but not everyone would fall back at the same time and some would react differently to the stresses of combat. Afterwards, the "conflict modifiers" would go away, leaving the dwarf as happy as they'd normally be, plus or minus any happiness modifying events that have happened.
For instance, one squad of five goblin siegers breaks through your outer perimeter and starts turning civvies into mush, even as the dwarves are wasting the force at the gates. While the other goblin squads might suffer heavy losses, this fifth one is elated and battle frenzied, even daring to plow through a small dwarf squad on the interior. One of them takes a crossbow bolt and staggers about, losing blood, eventually deciding to "last stand" in his current position. The other four, slightly concerned but still in high spirits, go on into the fortress inner sanctum. All of this goes on to the tune of a total route outside, of which the squad know nothing.
Eventually the triumphant dwarves return and find the goblins packing bags full of dwarven wares. A short battle ensues, in which all but one is killed. Half way through this battle, his élan well and truly evaporated, one steps back out of the fight and paths to the nearest outside. The escape route blocked by angry dwarves, he takes a similar last stand to the first wounded goblin, but after taking another blow to the leg, has his battle morale fall even lower, and so, in a terribly injured state, takes the only path left to him, a sewer opening leading to the outside. Only in his panicked state will he take a dangerous path, but that is the state he finds himself in. Whether he reaches the surface is immaterial. He wants out.
Getting down to the nuts and bolts of the suggestion:
Every sentient creature has their starting "élan", which is determined by personality irrespective of their mood. Their mood does have an effect though, in determining which "path" of élan they'll be following.
N.B. All of these must be in sight of the sentient for them to count.
"Allies" indicates any member of the civ, or friendly civ, animals etc, fighting a common foe.
The wounded modifier applies for every wound and is cumulative, so bruised = 1x modifier, missing = 5x modifier.
Ecstatic: An ecstatic combatant works themselves into an ever greater rage, repaying every slight with blood and suffering. Only by fully unleashing their fury can they lift the blood haze from their sights.
Wounded +1
Friends Wounded +2
Friends Killed +6
Allies Wounded +1
Allies Killed +3
Lover Wounded +3
Lover Killed +9
Pets Wounded +1
Pets Killed +2
Wounds Dealt -1
Kills Dealt -2
Foe has kills +1
Élan: While ecstatic soldiers may become the most feral and terrifying forces of destruction, the smallest crack will shatter them entirely.
-10 Drops weapon/shield, stands motionless.
-5 Drops weapon/shield, runs away.
0 Fights as normal.
+5 Will not kill unconscious target, instead chooses new target.
+10 Trances, will not kill targets with missing parts, instead chooses new target
20+ Trances, all physical attributes are temporarily two ranks better. Will engage new enemies constantly without regard for the old ones.
Very Happy: Very happy troops are strengthened by glorious battle, but will not rush headlong into death.
Wounded +0
Friends Wounded +1
Friends Killed +3
Allies Wounded +0
Allies Killed +1
Lover Wounded +2
Lover Killed +6
Pets Wounded +0
Pets Killed +1
Wounds Dealt +1
Kills Dealt +2
Foe has kills -1
Élan: Very happy troops are reliable in battle, displaying neither the excesses of strength, nor the depths of melancholy displayed by their battle-frenzied comrades.
-10 Runs away.
-5 Falls back to nearest allies.
0 Fights as normal.
+5 Finds new targets if friends are nearby
+10 Finds new targets if allies are nearby.
20+ Trances, will not kill unconscious targets, instead chooses new target.
Happy: Happy troops are reserved, but willing to fight. They're willing to forego posthumous glory.
Wounded -1
Friends Wounded +0
Friends Killed -1
Allies Wounded +0
Allies Killed -1
Lover Wounded -1
Lover Killed -2
Pets Wounded +0
Pets Killed +0
Wounds Dealt +1
Kills Dealt +3
Foe has kills -1
Élan: Happy troops will stoically hold the line. When forced, they will leave for safer ground.
-10 Falls back to nearest allies.
-5 Will attempt to disengage and rest a moment.
0 Fights as normal.
+5 Fights as normal.
+10 Finds new targets if friends are nearby.
20+ Trances, will not kill unconscious targets, instead chooses new target. Finds new targets if allies are nearby.
Content: Content warriors would rather not get involved, but will fight to survive. They are easily cheered by victory.
Wounded -2
Friends Wounded -1
Friends Killed -2
Allies Wounded -1
Allies Killed -1
Lover Wounded -2
Lover Killed -3
Pets Wounded -1
Pets Killed -2
Wounds Dealt +2
Kills Dealt +3
Foe has kills -2
Élan: Content troops will try not to fight on any terms but their own. Mob assaults and hit and run attacks are the trademarks of content troops.
-10 Falls back to nearest allies but will not pass too close to enemies. If there is nowhere to fall back to, will stand in position and fight.
-5 Falls back to nearest allies.
0 Will attempt to disengage and rest.
+5 Will attempt to disengage and rest if tired.
+10 Only attacks enemies if allies are nearby. Will attempt to disengage and rest if exhausted.
20+ Only attacks enemies if allies are nearby.
Unhappy: Unhappy troops will fight if they must, but will seek to escape if things turn sour. They take little joy from victory.
Wounded -2
Friends Wounded -1
Friends Killed -3
Allies Wounded -1
Allies Killed -2
Lover Wounded -3
Lover Killed -4
Pets Wounded -1
Pets Killed -1
Wounds Dealt +1
Kills Dealt +1
Foe has kills -3
Élan: Unhappy troops will only fight if cornered and may take desperate measures to escape danger.
-10 Runs away, but will not pass too close to enemies. If there is nowhere to run, will attempt to path through water to escape.
-5 Falls back to nearest allies.
0 Only engages if allies are nearby. Will attempt to disengage and rest if tired.
+5 Only engages if allies are nearby. Will attempt to disengage and rest if exhausted.
+10 Only engages if allies are nearby.
20+ Only engages if allies are nearby.
Very Unhappy: Very unhappy warriors are easily shaken and difficult to marshal once broken.
Wounded: -3
Friends Wounded -2
Friends Killed -4
Allies Wounded -2
Allies Killed -3
Lover Wounded -4
Lover Killed -5
Pets Wounded -2
Pets Killed -3
Wounds Dealt +0
Kills Dealt +1
Foe has kills -4
Élan: Very unhappy troops will put up only a paper-thin defence before seeking the shelter of safety, often blind to the dangers between them and their intended goal.
-10 Runs away, passing by enemies if they must.
-5 Runs away, but will not pass too close to enemies. If there is nowhere to run, will attempt to path through water to escape.
0 Hides in room, locks the door
+5 Only engages if allies are nearby. Will attempt to disengage and rest if tired.
+10 Only engages if allies are nearby.
20+ Only engages if friends are nearby.
Miserable: Miserable troops run screaming at the slightest cut, utterly unwilling to fight.
Wounded: -4
Friends Wounded -3
Friends Killed -4
Allies Wounded -2
Allies Killed -3
Lover Wounded -5
Lover Killed -7
Pets Wounded -3
Pets Killed -3
Wounds Dealt -1
Kills Dealt +0
Foe has kills -5
Élan: Miserable troops will fight like cornered rats, but will do anything to avoid harm.
-10 Hides in room, locks the door. If disturbed by enemies in the room, all physical attributes are temporarily a rank better and trances.
-5 Hides in room, locks the door.
0 Falls back to nearest friends, will not pass near enemies.
+5 Falls back to nearest friends, will not pass near enemies.
+10 Falls back to nearest friends.
20+ Falls back to nearest allies.
This is only an overview, I'm sure lots more can be done to make it more complex by the computer to give us more varied results, but what do you guys think?