Tempeh is easier to digest: the soy (fibers and amino acids) is pre-eaten by the mold.
I can drink milk but feel the same as you do with beans. When it’s fermented cheese I’m totally fine.
Can you eat falafels, tofu or slip peas? If so the hull may be the cause. Also beans trigger gaz on many people because they don’t eat much insoluble fibers, but after a while of regular consumption it comes back to normal. Don’t hurt yourself through, take care.