Of course a court can't tell anybody who to be polite to. That isn't the issue.
The practice of enforced shunning - including close family - might just be something a court can take action against.
The defense that JWs make their own personal decision to shun won't hold up to the most cursory examination.
The Closed Brethren got into some difficulty with the Charity Commission in the UK for similar policies.