It could probably be done with the RanDom program. You'd just need to ask the dev to add in options for changing variables of the capital, like starting troops and commanders. I don't think it would be hard to add.
It modifies maps, e.g. by adding a commander with spesific items/troops into a random province or a province that matches certain requirements, like terrain. It wouldn't be too far-fetched to add a requirement "this province is a capital of nation X" IMHO.