Studying diets is notoriously difficult, and rarely done in a helpful way. Everybody has a different internal ecosystem -- as well as different dietary stimulus, even if they're following the same diet. This makes it incredibly difficult to draw broad conclusions based on controlling just one or two dietary factors.
This is rather unfortunate -- because the right dietary treatments can be truly transformative for many people, for a variety of conditions. However, because of the difficulty of proving this scientifically, such treatments are ignored by the medical community, leaving patients to figure this avenue of treatment out on their own.
The answer, in my opinion, is massive funding -- the kind of funding that can compete with billion dollar drugs (such as Humira). However, that's really not going to happen. Oh well. Sorry for the rant!
I went GFCF for other reasons (IBS and excess mucus production) and was surprised when my Asperger's started to go away. My personal theory is that the small, but frequent, morphine effects interfere with learning. When you take that away, low level learning can begin again.
I was "face blind" (i.e. didn't automatically recognize familiar faces) and didn't pick up on social cues. Both problems when away after 6-12mo on GFCF. A lot of social awkwardness comes from not picking up on these fundamental inputs.
This cure for Autism is broadly related to the leaky gut hypothesis of autism, rather infamously propagated by Andrew Wakefield in the 90s more generally and Jenny McCarthy more specifically went after gluten/casein in the 2000s. PETA made an infamous ad saying that milk causes Autism [1] because milk has Casein. This is to say that enough noise got made about this specific claim it got researched a bit.
Generally this diet has specifically been studied for autism treatment and the efficence of it's efficacy is very lacking for me [2][3]
This all being said, this doesn't necessarily mean that nobody can benefit from a casein or gluten free diet, there's simply insufficient evidence to say that autistic people benefit from such a diet particularly often, and people who avoid milk and bagels are less autistic.
[1] https://www.dairyreporter.com/var/wrbm_gb_food_pharma/storag...
[2] https://link.springer.com/article/10.1007/s10803-019-04266-9
[3] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7651765/