In terms of North Korea, it might have been a reasonable strategy if there was any evidence of a lasting deal. As it is, it looked like a PR dance by both leaders. Who knows what was going on with the Taliban.
Regarding Iran, Iran had verifiably held nuclear enrichment to a set level. This was a deal that was working and Trump just pre-emptively left it and re-applied sanctions, and now everyone is mad / surprised that Iran is once again raising its enrichment level. There are essentially no or very limited ongoing negotiations with Iran. The point of the original deal was to prevent a nuclear Iran and it was working. Once Iran gets Nukes the international stage is very different. From an outsider perspective it very much appears that we have stepped back from the deal in order to find a reason to go to war.