Whilst I agree with others that this didn't seem a good fit for you and your employer, I'm surprised at the amount of people spouting nonsense about a subject they clearly know nothing about.
OP didn't need to disclose any disabilities to be treated in line with the Equality Act 2010, up to and above, making reasonable adjustments. To be in breach of the Equality Act, an employer doesn't need to have been informed of a disability, at all. Never. It is not a requirement for reasonable adjustments.
The law is quite clear - if the employer should have reasonably known, then there is a duty on the employer to make reasonable adjustments. In OP's case - this could have looked like: episodes of panic or anxiety that is manifesting physically (it is not hard to see when it manifests physically), low mood, apathy etc related to the depression. For a person with ADHD for example, this might look like a person whom is unfocused and easily makes errors, or hyper focusing to the detriment of other tasks, on the opposite end of the spectrum. It could look like a person struggling to sit or stand for long periods of times in physical disabilities, the list goes on. Employers don't need to know what the disability even is, just reasonably be expected to have known - and in all these aforementioned instances, an employer would be reasonably expected to have known, that something was possibly up, and make adjustments to support and help them in the role. We thankfully, in 2024, do not need to disclose all of our personal struggles, including disabilities, to employers, in order to receive support in our roles in an effort to support equality.
I'm also aghast at the lack of compassion in this thread, towards the OP's difficulties in processing this sharp change in her life. Losing a career, especially one you valued and were proud of, due to difficulties related to your disabilities - is extremely hard for disabled people to accept and process. The processing of this takes time, reflection, and a lot of sadness, to be frank. There is also a long process to accepting that your disability does impact you negatively, in a way in which it wouldn't if you didn't have those disabilities - and it's not fair. OP is allowed to be upset about this, even for a long time.
OP - you asked a reasonable, reflective and mature question here in order to grow personally and professionally - what could you have done differently. I'm sorry you've not received a lot of support here in actually answering this. Whilst you don't have a legal obligation to disclose disabilities, unfortunately we are still not there with equality yet (this thread is a perfect example of the attitudes included in this statement), and, until we are there, it will make your working life much easier in future, to disclose. Think carefully about what you could realistically achieve, and manage, with the right support in place, and what that support could look like. Is this something that would be reasonable for an employer to implement, and would you be very valuable to the employer if they did implement this support? I would also advise with future employers you join a union, and utilise their services when you are experiencing difficulties.
People are right that an employer doesn't need to retain your contact if you are seriously underperforming, 'just because you're disabled', as they eloquently put it. It does sound as if your mistakes were seriously impacting not just your work, but your bosses, and the overall reputation with clients, at times, and this was just not sustainable. You could have engaged better with outlining your difficulties, where they were coming from, and asking for particular support. Your employer could have done better in a lot of ways, too.
Its perhaps difficult to people without disabilities that impact their working life negatively, to understand or recognise that many, many employers do NOT want to deal with this, precisely because it makes the employers life difficult, and there is still a lot of indirect discrimination in the workplace, that someone without these difficulties would never, ever know about, or see sign of.
One thing you learn from and do differently OP - if you're going to make a drastic change to your treatment plan (completely coming off high dose SSRI's) for one of these disabilities, it's reasonable to expect you are going to experience difficulties related to this. You should take a period of leave to enact these changes, in order that it impacts your work as little as possible. This was a daft move on your part - it seems to be catalyst that triggered no end of problems.