Our girl went through the same thing last year. Our vet said the only way to properly diagnose the bacteria was to get a sterile sample, since when you catch it in a cup, there is bacteria from their outside, if you know what I mean.
After a sterile culture, the lab had to formulate a compound antibiotic since the bacteria was resistant to every antibiotic they tried. It took a 30 day course to finally get her better.
I asked the same thing too, as to why. Our vet said could be from her stools, especially as female dogs get older.
Best of luck.
Cheryl