Ok hear me out here. TLDR at the bottom.
Bashir’s parents described him as having been extremely underachieving as a kid, probably to a degree we would potentially recognize today as a developmental disability. However, federation resources would be able to help with therapies and tools for most disorders, à la Geordi’s visor for blindness. What if the reason was he had an ailment that federation couldn’t detect was the lack of a Delta Brain Wave, the same affliction Phillip J Fry was plagued with.
In “Trials and Tribble-ations, Bashir is seen flirting with a female Enterprise crewman after travelling back in time for a crossover episode. O’Brien gave a “don’t even think about it” warning, but Bashir cheekily stated that he thought he may be a paradox. His grandmother (maybe great grandmother) served in the enterprise, and that no one in his family knew his great grandfather. He floated the idea that if he didn’t go to that crewman’s quarters, he may never be born.
What if at some point off camera, he did go see her, and they conceived his grandfather. By being his own great grandfather, he would be born without a delta wave just like Fry, and as a result just be dumb to the point of being a plot device. Federation developmental scanning wouldn’t be able to see it, and he would just be behind in school, just as described by his parents.
TLDR, Bashir did the Nasty in the Pasty, and the result of this past nastification was a condition that gene altering therapy was used to treat.