It is important to remember that for every human cell that constitutes your body, there are 10-100 microbial cells--this human/microbe partnership, sometimes referred to as the human "superorganism", is part and parcel of evolution. We are only recently beginning to understand and explain the symbioses that stretch at least as far back in time as single-celled organisms themselves. It is widely held that the mitochondria present in all multicellular organisms are descended from a single-celled organism that was "eaten" (but not destroyed) long ago by another microbe--and we and all animals, plants and yeast are the descendants of the resulting organism.
A lot of what we know and are learning about gluten-induced inflammatory conditions indicates a role for our gut microbial ecology. Celiacs, for example, can be "latent" (they have "celiac genes" but don't have symptoms) for many years, until a course of antibiotics or a viral infection prompt some change that we don't understand, after which they begin having classic symptoms and eventually the defining symptom, villous atrophy. A recent letter in Science suggested a model for understanding Crohn's disease involving a complex interaction involving viral infections, irritants, and normal gut bacteria. See here: http://stm.sciencemag.org/content/2/43/43ps39.abstract
We have only begun to understand why gluten may cause problems in some people. To look for an adaptive explanation, especially one that is absent any scientific evidence or inquiry, is premature.
Yours is a well-intentioned question--but to answer it directly is to apply a very narrow model to an extremely complex evolving system, in which, for example, there are basically no "traits" (e.g. "gluten tolerance", "eye color" etc) that can be acted on by selective pressures independently of other traits.
I caution everyone against using facile interpretations of adaptation that amount to "Just So Stories." These tend to amount to unsupported "explanations" of why things are as they are that reinforce hidden cultural/historical/socioeconomic/medical/other established narratives and biases.
It's an understandable and extremely common mistake, but be VERY careful! This is the very same trap the eugenicists fell into, using fallacious and unscientific narratives to justify horrifying crimes against humanity.
These malformed arguments still deform the perspectives of too many scientists and medical researchers and practitioners. Adaptation is attractive because it is such a powerful explanatory tool--but it can only be invoked with scientific credibility after long and careful study, and discussion and debate in the context of academic peer-review. I don't mean to sound elitist, and I hate academic elitism, but it's dangerous to hand-wavingly invoke adaptation as a "scientific explanation" of the way things are.
Further reading:
adaptationism, evolutionary constraint (natural limits on the strength of selection), Eugenics, and adaptationist fallacies in evolutionary psychology.
I hope that helps!