There is a simple solutiion to this problem.
Code in the campaign script that checks for number of family members and number of faction settlements.
If a faction has one or more settlements and less than 4 family members then it should spawn a new family member near its original capital.
Preferably with a couple of units.
This is an example (without the extra units)
Code:
monitor_event FactionTurnStart FactionType hre
and not FactionIsLocal
and I_NumberOfHeirs hre < 4
spawn_army
faction hre
character random_name, named character, age 20, x 143, y 207, family
traits MilitaryInclination 2 , Military_Edu 2 , NaturalMilitarySkill 2 , GoodCommander 1 , Loyal 2 , ReligionStarter 1
unit NE Bodyguard exp 2 armour 0 weapon_lvl 0
end
terminate_monitor
end_monitor