Sure, tearing thousands of children away from their mothers at the border, and then losing track of them, all while lying about it — that was not a good look.

And, true, threatening to slap new tariffs on auto imports from Mexico may not be the best way to win ratification of a trade treaty the two nations (along with Canada) have negotiated.

President Trump steps from Air Force One with Rep. Kevin McCarthy (R-Calif.) upon arrival in Los Angeles Friday. (Kevin Lamarque/Reuters)

But, hey! He didn’t close the border! That would have totally upended the U.S. economy. It could have been worse.

This is a pattern, in domestic and foreign matters alike. True, Trump has insulted America’s closest allies and raised doubts about whether the United States would come to their defense, as promised in treaties. But it could have been worse: He hasn’t pulled out of NATO!

Yes, he has undermined the rule of law by trashing the Justice Department, asking the FBI to go easy on his national security adviser, defying legitimate congressional requests for information, trying to sic U.S. antitrust enforcers on a company he disliked, dangling the possibility of pardons to potential witnesses against himself, refusing to be interviewed by special counsel Robert S. Mueller III and much, much more. But he didn’t fire Mueller! It could have been worse.

He evicted a reporter who annoyed him from the White House and nearly abolished daily press briefings. But he hasn’t kicked out the entire press corps! He took Russian President Vladimir Putin’s word over that of his own intelligence agencies. But he hasn’t ended sanctions on Russia! He walked totally unprepared into a summit with Kim Jong Un and left with nothing to show for it. But he didn’t give away the store! He made 9,451 false or misleading statements during his first 801 days in office, as The Post’s Fact Checker has documented. But sometimes he tells the truth!

It could be worse.

This is, in fact, the foundation of his presidency. Trump was elected with the assistance of Russian spies and trolls, which he openly sought and celebrated. But he did not (or so we are told) secretly conspire with them.

And it’s true: That would have been worse.

But there are problems with taking comfort from the awfulness of what we have dodged.

First, it can cause us to lose sight of the awfulness we haven’t dodged. Take North Korea, for example. Yes, we should be grateful that Trump did not give Kim everything he wanted during their meeting in Hanoi for nothing in return. We should be even more thankful that Trump has not made good on his earlier threat to unleash “fire and fury like the world has never seen” on North Korea.

Meanwhile, however, Kim continues to build up his nuclear arsenal in a manner that Republicans, were Hillary Clinton president, would surely consider a mortal and unacceptable threat. And Trump allows this threat to grow while embracing and legitimizing one of the world’s most odious abusers of human rights — the killer of Otto Warmbier, of Kim’s own relatives, of thousands of Kim’s innocent compatriots.

Similarly, as we celebrate the news that Trump and Putin did not actively conspire, we may forget how constructive Trump’s foreign policy has been — for Putin. Largely abandoning Syria to the Russians and their Iranian friends; encouraging the Brexit chaos that is undermining democratic Europe; cheering for pro-Russian, anti-liberal leaders in Hungary and elsewhere: Putin couldn’t have scripted it better himself.

As we breathe a sigh of relief that the border is not shut, we may forget the thousands of families separated or in danger of separation due to Trump’s anti-Muslim visa policies, his miserly refugee policy, his churlish decision to seek the deportation of hundreds of thousands of young, law-abiding “dreamers.”

And there is another problem: Every time Trump conjures something unimaginably bad, he makes it that much more imaginable. Threaten to ban all Muslim immigrants, and a blacklist of “only” a half-dozen Muslim-majority countries becomes acceptable.

Float the unthinkably unqualified Stephen Moore as a Federal Reserve Board member, and the unthinkably unqualified Herman Cain becomes more plausible.

Every blustery, ignorant threat erodes trust, at home and abroad. Closing the border would be terrible. But threatening to close the border is not cost-free.

Those who take comfort in the idea that it could be worse, in other words, help ensure that it will get worse.