Been thinking long and hard on this problem. Since a problem related to militia clearly exists.
The militia could be nerfed individually.... and buffed by a "Garrison" mechanic. (to keep them useful against the strong gangs with 10-20 guys coming in at once. Npc are stupid afterall).
15 militia are present at any 1 time, (second nerf) with maybe 100-150 HP (third nerf) (Weapons dependant on the town), (fourth nerf) but you can have, say, maximum 50 militia in garrison. You cannot do this immediately of course, at max when you first take town you can maybe have 10 militia in garrison (after buying current militia). Every 30-hour you can add maybe 5-10 more to garrison.
I am also implying you can have 15 militia if you buy them the moment after you take town. (They are weakened, lessened, and your likely beaten down pretty badly by then so why not)? Then you can buy 10 more every 30 minute to an hour to add to the garrison.
Right after a militia dies, the garrisoned militia member will spawn from directly the town mayor. Or they could spawn from random houses, they are after all off-duty members of the community. These militia are easier to kill so they're likely to die in large numbers. This should add some spice to the fight.
This may seem contradictory to Marko's
NPC:2238
as you will be fighting many npc but they are very nerfed and are mostly just going to be used to buy time for the other gang to muster itself to retaliate, since killing off the militia currently is too fast despite being a tough nut to crack without really good coordination and gear and so they start the timer 5 minutes after entering the town. Because of this, as most gangs usually need about 10-20 minutes to gather itself to a sizeable force on short notice, they are unable to really defend the town and save their income, instead they just re-invade which seems contradictory to your goal of actually keeping the town for some time instead you are forced to accept the loss without ability to give it a fight.
Oh yeah, we also need a way to know if our town is being attacked. (The current controller of town only, not WHOLE wasteland)