Keepitflying! Thank you for your very honest post and I am sad for you on how your situation turned out. However, your own admission rather proves the fundamental point that these conditions rarely depart the afflicted completely.
In your case your rational reasoned processes led you to make an important very sensible life decision. Imagine though if instead of depression and anxiety the condition is tinged with suicidal or manically destructive thoughts. When will they ever go away. How can such an individual ever return to safe flight duty.
I applaud your post and wish you well for the future whatever that may bring.