So what happens when you remove doctor patient confidentiality?
In the US there is no true doctor-patient confidentiality when it comes to pilots. The medical certificate application requires a pilot to list all visits to a doctor in the last three years and the reason (item 19). Item 18 asks if you have ever in your life been diagnosed as having a plethora of conditions, including "(m) mental disorders of any sort; depression, anxiety, etc."
Further, FAR 67.413 says:
(a) Whenever the Administrator finds that additional medical information or history is necessary to determine whether an applicant for or the holder of a medical certificate meets the medical standards for it, the Administrator requests that person to furnish that information or to authorize any clinic, hospital, physician, or other person to release to the Administrator all available information or records concerning that history.
In other words, if you want to be a pilot* in the US, the federal government can ask you to provide access to any and all medical records there might be on you. If you say "no", they can yank your medical certificate. That means you don't get to be a pilot anymore -- not even as a sport pilot that doesn't normally need a medical certificate. It doesn't matter that the guy you share ownership of a sport aircraft with has never tried to get a medical certificate, if YOU had one and it was yanked you don't get to fly that aircraft as PIC legally, even though he can.
And making false statements on the medical application can also result in revocation of the medical. Simply failing to check the box for "depression" when you have been diagnosed and have not previously reported it is considered making a false statement.
* at any level higher than "sport".