I would fully support our military defending our borders, but they are trained to defend other nations' borders...
That includes borders, anytime, anywhere.
...or to create new ones as it suits US foreign policy.
Our very own Constitution hammers this point home in Article IV. Section 4. "The United States shall guarantee to every State in this Union a Republican Form of Government, and shall protect each of them against Invasion."
Put simply, the country (United States) protests the states (each of them) against invasion. I doesn't get any clearer than that. Ordinarily, that would be the border patrol. If/when they're overwhelmed, it is the duty of the United States to ramp up defenses, up to and including the United States Military. The Constitution further mentions the Army and the Navy and their duties.
The United States controls the United States military through both Congressional law and by direction of the President, our Commander in Chief (Article II. Section 2.). Including defense of our own borders, or anyone else's, as it suits U.S. policy by direction of our National Command Authorities.