Although plenty of Dems probably still believe Reagan's invasion was completely political and ditto for Repubs and Clinton's cruise missile barrage.
I think an argument in this case can be made that the timing is being dictated more by the nightly news videos of the caravan moving through Mexico than by the midterms. I am not defending Trump's move to deploy troops, I'm sure it is completely unnecessary. But the guy's main platform was "We're gonna build a beautiful wall..." Not surprising that he would take this kind of action, IMO. Would have happened, midterms or no midterms.