Good idea. Never thought 'bout it. And shouldnt be difficult to implement.
Maybe I am wrong and thinking about it to simple, but here is my thoughts.
1) Make list of faction names somehow conneted with game
2) If leader is not active -> check activity second in command or simple move leadership to him and check his activity later. This will make code little more simple, but more time will need to pass before faction deleted. Anyway, depends from time of checks.
3) If failed to find active members - move faction name to "deleted" setion
4) If name in "deleted" section then NPC starts to speak with lines as I provided before. As I understood - there is possible to add line for a group of NPC's.
5) If name was in "deleted" more than X time then move it to "availible"
Ot just simple make somewhere NPC to check for free names IG.