It's an old theme of movies, TV dramas and even cartoons: A nasty villain ties an innocent damsel to a railroad track, and her terror mounts as a train hurtles toward her -- until at the last moment, a hero comes to the rescue.

It's also a regular theme of the current administration. The twist is that the villain and the hero are the same person: President Donald Trump.

The revised NAFTA, christened the United States-Mexico-Canada Agreement, is the product of his peculiar approach to disputes.

First he heaps scorn on the status quo. Then he emits a torrent of demands and threats, some of which could be disastrous, generating anxiety and uncertainty. Finally, he extracts some modest changes, for better or worse, and invites the praise of a grateful nation. (In the case of North Korea, he then proceeds to fall in love with his negotiating partner, but that may be a one-time fancy.)

As a candidate, Trump reserved special disgust for NAFTA, which he called "the worst trade deal maybe ever." He vowed that he would withdraw if Mexico and Canada wouldn't accept major changes. As president, he repeated his threats, raising fears among automakers and other companies that their carefully constructed transnational supply chains would be tied in knots.

But last month, the administration reached an agreement with the Mexican government, allowing Trump to crow about his deal-making prowess. "A lot of people thought we'd never get here," he said. He also indicated that if the Canadians didn't want to accept the same terms, they were welcome to climb onto an Arctic iceberg and float away. The Oct. 1 deadline the U.S. imposed on Canada raised the prospect that the whole package could collapse, to the detriment of the entire North American economy.

Letting Trump conduct negotiations with foreign governments is like leaving teenagers unsupervised at home for a weekend. You don't expect to find the place in better condition when you return; you just hope it hasn't burned down. It came as a relief that Trump averted the disaster he had threatened to unleash.

The most important fact about the new version of NAFTA is that it would preserve more and destroy less than Trump led his followers to believe. But making a few changes and giving it a new name lets him strike a heroic pose.

Congress still has to decide whether to approve the agreement, but in general, it would preserve the North American free trade zone, with zero tariffs on the vast majority of goods crossing national borders. Companies would still be allowed to invest, operate and shift production according to economic logic rather than government-created barriers. Special visas that allow professionals in dozens of different occupations to move from one country to another would be retained, despite Trump's notorious aversion to foreigners.

There are some actual upgrades, as Gary Hufbauer, an economist at the Peterson Institute for International Economics, notes. U.S. companies and individuals holding copyrights, trademarks and patents would gain safeguards against piracy. Pharmaceutical companies that have to spend fortunes to prove the safety and efficacy of their medicines wouldn't have to worry about generic rivals reaping the rewards. Digital products would be shielded from taxation.

But most of what the administration got would impede commerce, restrict businesses and harm consumers. By 2023, at least 40 percent of the components in every vehicle would have to be made by workers earning at least $16 an hour. The administration demanded that provision not to lift up Mexican factory workers, who generally make far less, but to force manufacturers to move production out of Mexico.

Republicans generally oppose minimum wage increases -- which is what this mandate would amount to -- but if the change were to cause layoffs in Mexico, the Trump administration would count it as an achievement. Hufbauer worries that the precedent will mean "Democrats will put minimum wages in every future trade agreement." It would, of course, raise the price of cars.

The deal would also weaken protections for U.S. businesses operating in many sectors of the Mexican economy, making them vulnerable to onerous regulations that diminish or destroy the value of their property. Why would the administration want to expose American firms to greater risk in Mexico? Simple: to discourage them from investing in Mexico.

Still, the outcome could have been much worse. In this case, it's good to see the damsel escape from the tracks before the train runs her over. And let's just forget who put her there.

Steve Chapman (SChapman@chicagotribune.com) is a columnist for the Chicago Tribune.