When at war with another country, fighting rebels that appear in their territory give them back their land in addition to switching the allegiance of the troops used to fight them.
When I was in a war with Mexico, they had rebels appear in their territory, which I declared war on and defeated. The provinces I captured then immediately reverted to being controlled by Mexico and the 900 troops I used to defeat the rebels suddenly became Mexican as well.