I appreciate the change you’re trying to make, it’s nice to hear a parent recognising their behaviour and I hope this extends beyond guilt and into action (the most important step in my opinion).
A 17 year old will see right through a contrived conversation in a family setting. I think it’s important not to implicate his mother if she’s someone he feels he can confide in as it will likely affect how he sees his relationship with her in some way, but this depends of many factors I can’t possibly know.
If it were me, I think approaching him calmly and expressing your unconditional love for him as your child is very important, and maybe express the thoughts you have here about your regrets about your past behaviour. Even if you don’t bring up his sexuality, it sets a precedent that you are looking to heal your relationship with him. That being said, it won’t mean anything unless you can commit to this and he can be witness to this.
Ideally he will feel safe to come to you with this, but the sad truth is this may not happen. Personally, my mother wasn’t expressly homophobic but I still wouldn’t have come out to her if I hadn’t felt pressured by her to at 18 which is something I regret and has definitely impacted me.
So my advice is to heal your relationship first - hopefully he will feel comfortable enough to tell you one day, or it will arise organically. Make sure he has a safe space still, with his mother for example.
Like you said, you want to be the father your son needs, but his sexuality really is secondary. If you foster a loving and reliable relationship he hopefully will one day come out to you himself. He is also 17, which is a far cry from maturity, but also very far away from childhood - he is finding his identity as a person (who will soon be viewed as an adult) and at this point he does not want to be infantilised or feel like his privacy is being breeched. You need to prove that you have love and respect for him and that you are capable of change. And while you may feel that you need to get this off your chest, it isn’t really your place to do this, particularly after he has expressed in confidence that he didn’t want to involve you yet. I really don’t know him and he may be forgiving of his mother if he finds out she told you, but he also may not and this could be very damaging for him, particularly if he carries the weight of an unreliable caregiver. Maybe consider family counselling or advice from a Dr if it worries you. Best of luck.