The answer to that question is a complex one.
Yes, there were indeed examples were political considerations motivated military decisions. This is true for the Consulship - for example, when both Consuls were present in an army they were supposed to alternate commands. At the Battle of Cannae, one of the worst military disasters of Rome's history, Consul Gaius Terrentius Varro decided to lead the men into battle on his day of command, against the advice of his more experienced colleague Consul Lucius Aemilius Paullus but since it was Varro's day to command, Paullus could not effectively mitigate a colleague's bad decision. Paullus died in battle while Varro escaped to continue his career after the rout.
Later on in the Republic, the Consular system of command did indeed become outmodded as campaigns became more complex. Men like Caesar, Pompey, and Crassus launched grandiose wars and used their political connections to obtain extraordinary offices, or prolonged provincial governorships to maintain command of their forces. At times, men like Caesar made military decisions with an eye to enhance his political position back home - this wasn't unique to the Roman Republic, however, and exists across governments, cultures, and time periods.
That said the Consular system made a lot more sense than you might think. In the Ancient world, there was a concept of the 'campaigning season'. Meaning that during the summer, you would march off and fight battles, taking territory while the weather was good. Then in the Fall you would send the men home for the harvest, or into 'winter quarters' to wait out the bad weather before resuming campaigning in the Spring and Summer of next year. What this meant was, in effect, that a Consul would command a war for a single 'campaign'. And then if the war wasn't concluded, the next year's consul would continue the war during the next campaigning season. So having a Consul leave office and turn over command to his successor wasn't as disruptive as you may think, because there were organic starting/stopping points to warfare where this transition occurred.
Generally the system worked well for the early Republic, when Roman warfare was primarily concerned with Italy itself. At the start of the year the Consuls and the Senate would decide jointly on how they were to fight the war. Sometimes this meant that the more experienced Consul would be given an army and sent off to fight a campaign. In more complex wars, for example, one Consul might be sent North to fight the Etruscans while the other is sent South to fight the Samnites. Then when the year ends, and new Consuls are elected, the situation is reassessed and a new strategy is developed if necessary, or if not then the old one is continued.
However, as I said the system began to erode once more complex wars arose. For example, during the Second Punic War the Romans suffered some dramatic defeats which led to the election of Quintus Fabius Maximus as Dictator - a constitutional position for dire times where a single person was elected as a sort of sole Consul. Its existence itself being something of an admission that the Consular system wasn't always ideal for fighting wars. In any case, Fabius introduced a new strategy for fighting Hannibal where the Romans tacitly acknowledged that they could not defeat Hannibal in open battle, so they delayed and focused on outmaneuvering and undermining him. Eventually the Roman people grew impatient with this strategy and did away with Fabius, electing Varro and Paullus to lead the diasterous campaign that culminated with the Battle of Cannae, previously described at the top of my post. So then they went back to Fabian strategy and eventually won the War. This is the most major of example I can think of where the Roman Republic's political system led to an inconsistent strategy that ended disastrously.
So in conclusion, the Consular system of command actually made a lot of sense due to how wars were fought in the early days of the Republic. But as the Republic grew the system became outmodded and cumbersome for fighting wars far afield, or conquering vast swathes of new territory like in Gaul or Asia, so gradually command shifted away from the actual Consuls to men like Caesar, Pompey, Sulla, Lucullus - men who might actually be considered almost professional soldiers as much as politicians. To be fair, all of these guys were indeed elected Consuls, but commanded wars and responsibilities that exceeded their one year terms. And, arguably, this led to the circumstances wherein a man like Caesar, and later Augustus could overthrow the Republic.
In addition to any answers you get here, you may be interested in a post I made last year explaining how the Romans took the imperium (power/authority) of the consuls and started spreading and extending it to deal with their expanding empire.
I'm surprised that none of the other answers have made the point that the Republic did develop a mechanism for dealing with this exact problem: prorogation. The senate could to decide to prorogue a consul's imperium (the right of military command) beyond his one year term of office. The first recorded instance of this was back in 326 BC, when Quintus Publius Philo had his imperium prorogued so that he could complete the capture of Naples after his term of office as consul had ended, making him the first proconsul. As Rome began to fight wars outside Italy, prorogation became increasingly frequent, and was often renewed for several successive years. This became vital in the later Republic, when there might be several campaigns going on in different parts of the Mediterranean at once, for which two consuls holding office for just a year would have been totally inadequate.