Flour is a high risk food as it can be easily contaminated with bacteria such as Salmonella.
Salmonella and other bacteria can get into the flour through the processing plant as well as the transportation of the flour etc.
As the flour comes from wheat and is then transported to a grain elevator and then is stored in the grain elevator after being transported in open grain hauler trailers.
Then the flour goes through another plant where it gets turned into flour.
During those travels of the flour through it's journey to make flour it can pick up all kinds of contaminants that you cannot see.
Even though they try to reduce the risk of contamination of the flour it's impossible to prevent the contamination of the flour 100 percent.
So that's one reason you don't want to eat raw flour or raw dough because the bacteria can be present in it.
Once you cook the flour though then the salmonella or other bacteria is killed off so it does not make you sick.