It has been investigated how the gut microbiome can affect the immune system of the body. It has been noted in several studies that having a good microbiome in the gut enhances our immunity, too little and suffer a much less effective immune system. There are many studies which can be searched about it (e.g., Frontiers | The associations between dietary fibers intake and systemic immune and inflammatory biomarkers, a multi-cycle study of NHANES 2015–2020) and the roll of dietary fibre such as these long chain saccharides that are not digested and adsorbed by our body but the microbes in our gut utilise them. It is thought there are a number of reasons for the improvements but one they are relatively certain of is Short Chain Fatty Acids (SCFA).
Our modern diets are often lacking in enough dietary fibre particularly when consuming highly processed foods.