Period Sex and UTIs

Has anyone else noticed a link between period sex and UTIs? I just got diagnosed with a UTI this morning. Ugh. I had one exactly a month ago as well. Starting to notice a pattern. My bf and I go to different colleges so when we see each other on some weekends... you know what goes on. And I think maybe having a lot of sex towards the end of my period might be causing these UTIs. I’ve had a lot of sex in between my first one and now and didn’t get one then... so I’m thinking maybe. I already take D-Mannose powder every day to flush out my bladder (been using it for a year) and I always pee after sex and try to always use a wipe if I can’t shower right away. I’m also on the pill. Any insight would be greatly appreciated!