First off, it's very sweet of you to turn to this community to ask for support from women who know what your gf is going through. Not a lot of men can accept defeat that they don't know anything about something, especially when it comes to women's health issues.
Regardless of how long you've been together, this is a time when she actually needs all the support she can get. There's the BS of saying you should respect her decision of breaking up, but if she was your typical woman, it might have been for several reasons and dilemmas why she chose to end it. Maybe she didn't want to burden you, or maybe she thought you won't understand. Maybe she catastrophised things and thought she is a mess and can't have kids anymore because of a possible diagnosis. There's a lot of reasons why she would choose to break up, please don't blame yourself because in a woman's world, it's not all black and white. With our raging cocktail of hormones, it's quite a colourful world we live in X
I hope you can find a way to let her know that you are SORRY to have not realised her struggles, worried about her and the upcoming surgery, and that you are still there if she needs you.
Update me and let me know how it gets on if you don't mind. Best of luck! X