You're right - good point. For one way, I guess you could let p_i represent the ith prime number (there are infinitely many) and use p_x / p_y instead. Unsure about the other way.
There's a general result that the set of "All pairs of elements from two countable sets" is, itself, countable. (the Cartesian product of two countable sets is countable).
For example, the set of all pairs of natural numbers can be counted something like this: