Autism may be one of many malfunctions of a system existing inside humans. As homo sapien sapien have evolved their unique traits, especially the ones in our brain, in a span of only hundreds of thousands of years, I suspect there is a lot of room for malfunction. This is why dogs or dolphins don't get autism, schizophrenia, bipolar, or parkinsons.
Bipolar may be a malfunctioning of an adaptation of a survival mechanism of staying put when resources are scarce and getting up and going when it's time to hunt full of energy. Notice though that it isn't claimed that this instinct humans have/had is bipolar disorder itself. A person with a healthy level of certain traits is beneficial to survival of the clan, but I don't think someone with the brain damaging mood swings and negative symptoms of bipolar would last long.
In a similar vein, I don't think autism spectrum disorders themselves played a vital role in human survival, they were a part of evolution, I don't deny that, as in whatever mechanism that existed was beneficial but could screw up and bite a person in their tushy. Which is Autism DISORDER, or a disorder of (lower case) autistic traits found in many people that don't disable them at all.
A similar argument is that cushings disease could also be said to have played a role in human evolution since cortisol is a vital steroid hormone that regulates our activity in the same vein. But if you have too much cortisol, you had a disorder that would spurn any benefit of cortisol and the mechanisms it's a part of. Or more familiar, diabetes, insulin is a vital human substance, diabetes has been a part of our evolution, but you were dead in less than a year before we invented insulin needles. What use does diabetes have?
The person with a good level of insulin and kidney function is beneficial, but if that existing mechanism is disrupted then there is no benefit to be had.