I got an A- in Discrete Math, failed or nearly failed all other math courses and failed out college after 4 years, some of which was attempting a major switch from CS to Philosophy, which also failed because I really just wanted to program. That said, for the last 18 years since then, I've had a career in software engineering.
The concepts taught in my programming classes almost always just made sense to me (for some reason, it took me forever to understand static), just as did many other things about computers since I was first introduced them around age 8 or so. It was so intuitive and sensible that I often didn't even go to my programming classes for a good portion of the semester and still ended up with A and B grades. I've often wondered exactly what the disconnect was for me, as I've often heard people make similar assertions as you have.
I was able to take Vector Geometry around 2.5 times, and after that, I actually ended up with, I think, a high B and really felt like I understood it. That didn't matter, though, as I wasn't able to replicate that with every other math course required for my major. Since then, as an adult, I've really enjoyed at least shallowly consuming mathematical concepts, mostly via YouTube channels like Numberphile and 3 Blue 1 Brown.
A few other comments referred to personal experiences wherein the individual just never learned how to study and how to integrate information and concepts that didn't just make sense intuitively and immediately (remember my second paragraph?). My main conclusion in my life has been that this is mostly what the problem was for me. School up through high school was not difficult for me. I was, relatively, a high achiever, but I put forth the absolute minimum of effort to get there. The programming curriculum was basically more of the same, as it was very easy for me to understand and integrate. Everything else? Total mess.