I am so sorry for this 5 year plus painful heartache you have been going through with your boyfriend. Romantic attachment is one of the most complex areas for all human beings, no matter their age, intelligence, or status. When you add children into the equation it makes it that much more intense.
The way we were built is too form long lasting attachments; to enrich our lives, to not do life alone. Unfortunately, we live in a world where people are broken and instead of loving each other, often we hurt each other. The problem with attachment, it can be like super glue, once the glue dries the two pieces will have to be broken to separate them. This dynamic of attachment is blind, it just knows to stay attached, it doesn't know that this attachment is causing harm.
Learning how to love yourself enough to do what is best for you and your children is a process. This is especially difficult if your boyfriend is a manipulator which it sounds like he is if he is threatening to take away your child. In order to best take care of yourself, you need support. Finding a competent therapist, would be an immediate way you could get support. Therapists are use to dealing with complex relational problems, and could help you walk through the process of what is best for you and your children. Other forms of support would be wise and safe friends, support group, or a local church that offers support groups depending on your spiritual background.
Most importantly, I want you to focus on taking care of yourself, your pregnancy and your 4 year old. You shared that this relationship is emotionally destroying you. That is an important realization. Also, that you need help and support. Hopefully, you can ask your peers if they know of a good support group or therapist. You can also ask your Medical Doctor, he/she will know of reputable professionals in your area. Here, in America, we have different associations, California Assoc.. of Marriage and Family Therapy, American Psychology Association where one can find referrals in their area. I researched some European Associations, that ,hopefully, can also lead you to a competent therapist in your area (links below). Definely, pay attention to your distress and seek out professional support. There is a way through your difficult situation, with support you can heal from the pain you have suffered and find solutions for your current dilemma.