Were the Roman legions able to march on Rome

The only exception was in the case of a Triumph, where the commander laid down his command upon entering the Capitoline temple of Jupiter at its end. Roman soldiers were not prohibited from entering, just their leaders. Soldiers who crossed the Pomerium in advance of their commander did so under temporary departure from his command and came under the postestas of the civil magistrates.
Rome had a force present, sufficient to man the walls and watch the gates. Additionally, as long as the commander stayed on the opposite side of the Pomerium, there was no law prohibiting him from camping outside the city despite the fact that he could not enter with his army in tow.