In some office cultures it is normal. At least in the women's room, conversation happens. I don't think it's why we're all in there so long - but waiting in line for 10 minutes will eventually prompt conversations.
I get a sense from male friends that it is less OK in the men's room... but I bet that mileage varies.
I would say that, for either gender, you're well within your rights to expect private time in these moments, and whether or the other person finds talking in the restroom to be weird, it's fine if you do, and it should be fine to express it as long as you do so in an inoffensive way.
I've noticed that polite, clueful people will say "mind if I ask you a question?" or something similarly cautious - at which point, it's totally fine to say - "give me a sec, wait for me outside" or something similar.
On the joking (funny as some of the jokes are) - I think you need to figure out what kind of expression works for you. If you are not naturally a person who cracks jokes, a false attempt to do so in the restroom will read as just as awkward and weird as talking in the first place. OTOH - if you are one those people who can be crude and yet make everyone in the room laugh with your infectious benevolent charm - go for it and steal one of the great jokes in this thread.
If you don't think you can pull off peeing, joking and not being awkward - say as calmly as possible - "can we take this outside?" When you've gotten outside, make sure you ask what the question was, and say "hey, I just find it weird to chat in the restroom... it's just awkward." That way the other person knows what's wrong and probably won't repeat it.
The only thing I'd avoid is a super serious, much delayed conversation. Saying, randomly, in a 1 on 1 - "hey, I wish you wouldn't ask me questions in the bathroom" - is pretty difficult and off putting. Much better to catch the culprit in the act.