It was a strange idea that popped into my head. Could wild infectious microbes be bred (directed evolution) by some mechanism (such as through hypothetical drug therapies) to "domesticate" them and reduce their infectious qualities? Can we transform infectious microbes into innocuous ones rather than fighting against their antimicrobial resistance?
You have three separate issues here; I'll focus on how they affect bacteria in the gut. First, are different yet similar bacteria better or worse for people? Clearly yes; with various types of Escherichia coli being common and usually benign inhabitants, but E. coli O157:H7 causing severe problems.
Second, can directed evolution coax a bad type of bacteria into being a less harmful type? Also clearly yes: this is being done all the time in the biofuels industry to create bacteria with specific abilities to break down and reform materials into fuel.
Third, can such improved bacteria be used to crowd out the bad bacteria? Again, yes: Clostridium difficile is (see the name) a difficult-to-control gut inhabitant. Classic treatment with antibiotics has not been very effective, but transplanting good gut flora with fecal microbiota transplantation (FMT) seems to be very effective in the limited studies so far.
The trouble is when you want to combine them all. FMT is still controversial, because it's difficult to control exactly what gets transplanted, and we don't completely (or even mostly) understand the functionality of the gut biota. What if a transplant recipient goes downhill in an unexpected way: was it the fault of the transplant? It may be tough to tell, but lawyers could make enormous amounts of money on the question. Now, if you're working with a designed bacteria, the consequences could be even harder to predict, and the legal fault could be even clearer. (Plus there's the "ick" factor of poop transplantation.)
To summarize, the basic idea is good, but the proof is in the implementation.
In principle, this is what happens with any vaccine using an "attenuated" virus or bacteria - they have been directed through essentially forced evolution to lose some of their properties that effect virulence - how sick they make you when you get infected.
Some examples of this include the influenza nasal spray vaccine or the type of polio vaccine used in developing countries. These are both viral examples, but bacterial examples exist, including tuberculosis.
In a grander sense outside vaccination research, this is theoretically possible, but has some complications. The first is whether or not you can actually get attenuation. There are some microbes (norovirus and C. difficile come to mind) that are very hard to culture, so this kind of directed evolution is difficult. And, if successful, you'd have to reintroduce them in a setting where the "full strength" microbes exist, and if those full strength microbes have a selective advantage in the environment, the engineered strains are unlikely to be successful in the long term.