Modern hospitals and antibiotic treatment alone did not create all the antibiotic resistant strains of bacteria we see today. Instead, selection pressures from before widespread use of antibiotics influenced some of them to develop, new research has discovered.
source https://phys.org/news/2021-03-full-evolutionary-journey-hospital-superbug.html