I'm sorry you are in pain and struggling with your mental health. I hope you are getting professional support.
You say you feel guilty and that you have abandoned your child and that people say 'a mother should never leave their child' But you also say that you know that the current custody arrangement is what is best for your son.
Firstly on the abandoning. Many parents split up and residency of the child is split other than 50/50. This does not mean the parent with less than 50/50 has abandoned the child. It's not the case with other people (I'm sure you don't consider that the case with other people) and it is not the case with you.
So you don't have to feel guilty with regards to 'abandoning' your child. You have not abandoned him you have just split up with his father, a very common occurrence.
'a mother should never leave their child' - again you have not left your child. You have split with the father and you have contact as is appropriate at this time, you agree. While it is true that the female parent is more often the primary caregiver and more often the parent who has most custody after a split this is not always the case. But because it is most common/traditional some people view not living with the mother a greater 'shame' for the child than not living with the father. But both parents can give care to a child and you say that your ex is a good parent. You know that your child is being well looked after.
So you have no need to feel guilt on this matter.
When a couple split up, if you have read threads on here, you know that both parents will always be urged to put the needs of the child first, above their own desires, needs, or ill-feeling towards their ex, even when the ex is being an arse. In this case you say he is not being an arse but a good parent. So according to your posts the current arrangement is what is best for your son. You could have made things a lot more messy by fighting for custody even though you apparently are not up to taking on that role at this time or running away with your son and trying to deny his father access. But you didn't you stepped away despite your own pain because you put your son first, which is exactly what parents are urged to do.
So you have no need to feel guilt on this count either.
That said I'm sure all parents who split up feel some guilt about what effect the split has on their child and whatever any of us say you will not be able to entirely shake it off.
Good luck on your road to recovery and in your future relationship with your son.