I've always assumed that the bubbles formed because they're coming out of solution after the water pressure drops. Inside your plumbing, the pressure is high and the water can hold a lot of gas, and then after you pour it into the glass, the pressure is lower and you have a supersaturated solution, and the gas gradually comes out of solution at the nucleation sites on the glass walls.
Suggested experiment: take such a glass of water after it's been standing a few days, and pour the water into a new glass. See if new bubbles form.
Another thing to try: seal the water off from the atmosphere, while leaving it at approximately atmospheric pressure. Maybe you could invert a glass full of water in a tub, taking care not to trap a bubble? I'm going to do this right now!
The inverted glass gathers about as many bubbles as the upright glass, so the gas seems to be coming from "inside" the water, and not diffusing there. I didn't notice any bias toward the top of the glass at my first check after a few hours, but now, after two days, the inverted glass has some more, and larger, bubbles near the top, where they get trapped. I'm speculating that that's just gravity doing it's thing: occasionally a bubble will detach from the walls and simply float up, although I don't have the patience to see if they ever reattach to the walls rather than simply always continuing to the top.