As the law views it, announcing that someone who has withdrawn from the congregation/organization is no longer a member does not constitute discipline of that person. Telling active members to, in turn, avoid association with persons in that class is, in a direct sense, control of the active members, not discipline of those who have withdrawn. Just as a religion would have every right to tell its members to shun drug users, homosexuals, or members of another religion, an unfair as it might seem, it has every right (under U.S. law) to tell them to shun former members of its own religion. A court is going to view a chuch telling its members to avoid a certain class of people in the name of their doctrines as part of their right to free exercise, not as improper discipline of former members.
As for letters that have resulted in non-announcements, I am sure they work sometimes. Empty legal threats can sometimes be quite effective. Companies send baseless cease-and-desist letters all the time to individuals without legal training hoping that the letter will intimidate the recipient with the threat of legal action, even though there would be no hope of the sender actually enforcing the threat. It would not surprise me at all if bodies of elders may decide not to anncounce a DF/DA if they are afraid of legal action being taken against them personally and they will have to hire a lawyer, etc. There are also those who have sent letters and they have been announced anyway, with nothing they could do about it. As for the idea that the announcement coupled with coded messages to shun is a violation of the law, that is fine as a novel theory, but it has been rejected by courts. It is black letter law in the U.S. that WT-style shunning and announcements are entirely legal.