This is one of the major reasons I'm so adamant about people going into deep introspection before ever choosing to have children. Once you've made the decision to procreate and become a parent,your priorities change completely. I hate to tell you this,but choosing to CTB once you've already become a parent is going to be morally gray at best.
I won't pass down any harsh judgement on you,OP. Because this is largely society's fault for brainwashing into people the idea that having children/becoming parent is a "must" or "eventually what everyone does." and any questioning of that is judged politically incorrect. I could have ended up just like you,but I was fortunate enough to discover that becoming a parent is an option,and not some obligation you must inevitably do early on. (I've even inevitably come to the conclusion that procreation is a morally questionable act in and of itself; a belief known as Antinatalism)
Unsolicited advice incoming...
If you truly want to retain the ability to CTB with minimal ethical consequences,you may have to make a difficult choice. Either look for suitable(financially well off,loving,educated,etc.)adoptive parents and get your spouse/SO to agree to this decision,or leave the relationship while the child is still a baby and never get involved with them other than paying child support till you CTB. (This is assuming its too late to abort. if it isn't and the option is available to you,that's your best option)
Or another option...Kill yourself now while your child is still a baby and therefore can't get attached to you,but I'm assuming you're unwilling to take this option.
Of course,there is the publicly accepted option of getting/help therapy so you find the will to live,but I myself can't advice you regarding that. you might have to ask the mods.
I hope my message is helpful. It really sucks to find yourself in such a moral dilemma.