Can someone help me figure out why eating mushrooms makes me feel ill?

I love mushrooms and used to eat them in a lot of different foods frequently. As a former vegetarian they were one of my favorite foods.

About 5 years ago I started (rapidly) noticing that eating cooked mushrooms was giving me awful stomach aches. It never coincides with any other symptom and I recover fast, but about 20-30 min after eating them I’ll be in a moderate amount of pain for about a hour. I tested a couple things and it seems more likely that this happens with very cooked mushrooms reaching a caramelized consistency, and it’s less severe with seared or even raw mushrooms.

I’ve honestly never heard much about this being a thing and am wondering if anyone else has experienced this or heard of it? Would this be considered an allergy? Most people I talk to about this are really unhelpful or dismissive, I think they just think I am a picky eater lol. Would love to figure this out and hopefully find a way to eat mushrooms again because I miss them.