My understanding is that something like that can cause lactose intolerance as well.
My daughter developed lactose intolerance after having her appendix out and it has gradually cleared up.
My sister had it for a few years and it went away on it’s own as well.
It wouldn’t surprise me that other intolerances are a result of a disturbance of the intestines.
Gluten intolerance includes versions of proteins that bind to the gliaden protein component of gluten. It is bound in a manner that optimally exposes the antigenic surface for the immune system to mount an immune response. In addition, the cells of the small intestine normally have "tight junctions" to limit passage of large particles into the blood stream. In gluten intolerant individuals, the immune response to gliaden provokes expression of "zonulin". The zonulin protein turns the tight junctions into "loose junctions". Larger particles in the digestive tract can pass into the blood stream. That expands the possibilities for expose of more antigens to the immune system.
There is a variant of the casein protein in Holstein sourced cow's milk that produces peptides with a morphine like structure when hydrolyzed by digestive enzymes. In a gluten intolerant individual, this morphine like substance can pass into the blood and produce a narcotic impact on the brain. The simple fix is to avoid gluten and dairy. Sometimes it is not so easy. Unintended exposure leads to a few days of extended trips to the "reading room".