Yes I get this with pasta, potatoes, bread - it’s not a gluten thing for me as gluten-free doesn’t make much difference. I just have to eat less as it seems having too much overloads my digestion.
Drinking plenty of water helps and switching to less dense things or eating less, like:
sweet potato instead of white potato
having one slice of bread instead of two
toast is better than bread
very cooked pasta (like lasagne or a reheated pasta dish) is better than a normal once cooked pasta dish
I avoid dense things like scones, bagels - go with a crumpet instead (it’s half holes/air!)
basically eat less or cook the food more as cooking helps break down the food (so does part of the digesting for you)
Dunno if any of that is scientific, it’s just what works for me.