I don't know how people put up with waking up to pee. Is it really worth it to eat/drink within a few hours of bedtime if it's going to wake you up at 3am?
You can fix the habit by waiting a half hour longer to pee each night until you can make it to the morning, but this does involve lying awake in bed for a while, which is much worse for your sleep than just getting up quickly to pee.