Why do you suppose this? I don't follow.
I understand that is the reality on Earth today. The non-sanctioned civilian militias and paramilitary groups seem more prevalent in rural areas as opposed to urban areas. That seems to be due to the nature of these groups, though. They value the anonymity and space that rural settings provide. The threat they feel the need to train for is terrestrial.
Terrestrial is one thing, but having the ability to provide defense for one-self is critical.
The reality of any sudden attack situation from a sudden random aggressor is that:
1) You won't know when it'll happen, so you will get surprised.
2) You can only prepare so much while living your daily life, so being armed is just common sense for those who value their lives and don't want to depend on random luck of a kindly armed stranger to save you.
3) Most often time, aid comes in too late and the enemy is gone; and you're dead/injured/incapacitated,etc if you can't fight back.
Seconds matter dramatically in these situations.
With regards US sanctioned and backed national guards (the modern equivalent of state militias) they are located it seems equally in both urban and rural settings. Like the non-sanctioned militias, these too are training to defend against aggressors based on Earth.
Ground Combat doesn't change if it's in a building on a M-class planet or in a space station.
Room to Room clearing is very tediuous, dangerous, and could be very costly in terms of man power, lives, resources, etc.
There are some things you need to worry about not shooting, but most things are generally the same for Urban CQC/CQB.
Defending on a Planet and Urban Warfare are both equally valuable, the skills needed changes based on terrain you're fighting in.
What happens if you get caught in a StarGate like Portal that drops your people onto a Alien Planet and you have to defend yourself with the weapons you have?
In the Star Trek future, that is a realistic probability.
How many Star Trek episodes have we seen where a Random StarFleet Officer gets Kidnapped and have to survive?
Plenty.
In contrast, a 23rd or 24th century militia would train to defend against aggressors from other planets. Wouldn't urban and rural locations be equally at risk to alien attack and invasion?
That's for the Space Naval Assets to worry about.
The Ground Pounders and Soldiers / Boots on the ground worry about ground fighting and being called into action at a moments notice.
Everybody has their specialty.
As for Urban / Rural, it depends on what the Alien Attack / Invasion is all about.
Is it "General Terror", is it targeted at military assets, is it resource acquisition, is it pure genocide?
You won't know until it happens. So be ready to fight.