This is a tough one. I think your company is out of line for suggesting, whether stated or implied, that you aren't welcome in either restroom. I would not suggest limiting liquids if at all possible. Dehydration is a very real thing. I don't think you want to faint on the job and have your boss after you about that as well.
You mentioned taking short breaks. What about a lunch break? If the university is too far, is there a gas station or fast food restaurant nearby? I mention those because they are used to people just coming in to use the bathroom and not buying anything. If neither is available, you might just have to use the women's restroom at work until you are legally male. Customers might give you looks, but it's better than having a painful UTI.