But there's still other factors. The people "scraping through" may have not been able to spend as much time studying as those who passed easily, either due to family/caring responsibilities, or an employer who didn't give much time off/support for studying etc. Someone who's had to take re-takes in professional exams doesn't mean they didn't have the ability to pass first time.
I agree with others that passing exams is more nuanced than simple intelligence. Putting the time and effort in is just as important (or having the luxury of being able to put time and effort in!).
Right from early years with our son, we've instilled into him a basic work ethic of doing his homework, revising for tests/exams, etc. He wasn't "academic" at all in the sense that he's never been interested in knowledge for the sake of knowledge, never read anything beyond the age of around 10 except for school work/homework/revision, etc. But he's a plodder. Got a full string of grade 9 at GCSE, full suite of A* at A level, a First degree in Maths and now half way through his professional actuarial exams in his workplace. He's not remotely "Interested" in any of that. He's just a plodder who puts the work in when he has to and knows how to pass exams. Part of that is that we ensured he had the environment, i.e. desk and equipment, a quiet house to do his homework, parental "pushiness" to ensure he did his homework, parental engagement with the schools etc. Even now, doing his professional exams, he has loads of paid study leave so never has to study evenings nor weekends, all his study materials and exam fees paid for by his employer, living on his own, so a quiet flat with no spouse/partner/childcare obligations, etc.
He's certainly no more intelligent than some of his peers working in the same place who are struggling and failing some exams - those who are married and/or with children, so trying to juggle family commitments alongside trying to study for exams etc.
Back in my day studying to be an accountant, I had a miserly employer who gave no study time so I had to study evenings and weekends. I also had to have a weekend job as pay was so low, so worked all Saturday and Sunday mornings, leaving me only Sunday afternoon. Also doing voluntary work 1 or 2 evenings per week. So my study time was squeezed and yes, I failed and had to re-take 1 of the 16 professional exams I had to pass. Before that I'd only managed grade D's in my A levels (again self studying alongside full time job) but it was enough to get into the accountancy body! I basically did what I had to do to scrape passes. If I'd had the luxury of lots of study time, or not having to work weekends, etc., I know I could have sailed through the exams with much higher marks.
So, no, I don't think even professional exams are particularly onerous to pass. If you get your head down and plod on, keep your eye on what's important in the exam, know the mark schemes, etc.,
Obviously, you're not going to get into a top 4 firm with poor A levels to start with and won't make partner if you've only just scraped through your exams and not "high flying" in your workplace, but you'll still have a good career, whether an accountant, solicitor, etc.
Some of the doctors and consultants we've come across in our 60 years of life have also been pretty unimpressive. Some have been remarkable, but again, like all professions, there've been a lot of "Plodders" - OH had seen plenty as he's had cancer for nearly a decade. He's seen a massive difference between different oncologists - one was a real high flyer who was on top of all the latest research, etc., another was a "plodder" who didn't really know anything about recent developments and new treatments coming.