The Roman Republic, as a political entity, was able to muster enormous resources relative to its size, and in the midst of calamitious circumstances too. The best example is the Republic raising legion after legion with which to challenge Carthage, and maintaining the loyalty of all of the cities allied to it, after Hannibal's army had defeated it in a string of battles, and finally, killed a significant fraction of its male population at the battle of Cannae.
I assume it was the construction of the Roman government, with its elected leaders, and the political culture of the Roman polity, that viewed the people as the source of all power (as exemplified by SPQR), that inspired this cohesion and loyalty, and it was these qualities that were the primary and ultimate source of its power.
Roman generals in later centuries frequently seized power to become emperors, and this in turn undermined the basis of Roman power, which was a large subsection of the population and fraction of power centers being integrated into the political establishment through elected positions, and consequently having a stake in the success of the state. So the suspicion the elected leaders had towards generals may have been well-founded, and been the reason the elected government maintained power for as long as it did.