holy shit that... is insane. Also how is this not illegal?
Exactly, why would a court permit that? Isn't it standard that evidence obtained illegally is not permissible in court?
The article is talking about subpoenas – court orders for disclosure of relevant records, which override ethical and contractual confidentiality obligations, unless the person holding the confidential documents persuades the court to quash or limit the scope of the order. https://www.apa.org/monitor/2016/07-08/ce-corner
This is why I've never used any EAP or any other form of mental health service in any way connected to my employer.