I suspect it depends on whether the AME is made aware of it. If you see a psychiatrist privately then your GP need not necessarily be informed - though arguably if you did not want your GP to be informed and the psychiatrist knew you were a pilot that might be fishy enough for them to breach confidentiality. Any doctor can write a sick-note. It doesn't have to be a GP.
The AME will only know what he/she can glean from the patient, and the GP notes. And yes, you could be struck off for a breach of confidentiality even in the UK.