Did you have a catheter at any point during the surgery, or after? If you did, that can cause a UTI.
Did the surgeon who performed the surgery diagnose you with the UTI? Make sure that he/or she knows about the infection. You'll want to make sure it's not a complication of the surgery.
Let us know how you're doing, and feel better soon!