Would the Soviets have fought on, even if the Germans had taken Moscow in 1941? almost certainly yes, STAVKA was never in danger and the Germans would prob have had much the same miserable experience in Moscow that Napoleon did.
Would the Nazis have fought on if Hitler had fled Berlin to the Bavarian redoubt, as many beleieved he would? Possibly.
The Allies captured Rome, but Italy (sort of) fought on.
The Yugoslavs were completely occupied but fought on and liberated themselves (there's a lot more to that story but that's for another time)
Would the British have fought on if Britain had been occupied and London the seat of a Reichskommissar? oh yes.
Would the Japanese have fought on if the Bomb hadn't been dropped and the Emperor not surrendered, even if Tokyo had been captured? yes.
capturing Baghdad certainly hasn't stopped organised Iraqi resistance, has it?
Capital cities are anathema to military offensives, while they are strategic targets for politicians and planners, commanders hate them. They're almost always heavily defended and too much hard work to capture. The Germans had to lay siege to Paris for 2 years before the city surrendered, even though the French Army had been rapidly & soundly defeated at Sedan.
The only use for a capital city in purely military terms is as somewhere to have the victory parade