The problem with an EMP attack against the United States is the domino effect it would have for the world economy. As the U.S. economy flushed down the drain, there would be an economic void that would take everyone with it. Mass nations would die off from starvation and disease as the U.S. food products failed to make it to market. The living would not know how to deal with all the dead.
You have it right. Unfortunately, the deterrence this provides assumes that our adversaries are sane and do not wish the end result.