To insert a node, generate a random bit string: descend the tree and when the counts are equal then take the branch corresponding to that position in the bit string. When the counts are unequal, take the branch with the smallest count.
To remove a node just remove it from the tree and update the counts up along its path to the root. This assumes that articles are added as often as they are removed.
To sample, just generate another random bit string and traverse the tree according to it.
But I agree with the sibling comment that the current non-uniform algorithm is fine for a cute “Random article” button.
It could even be maintained entirely outside the Wikimedia servers, relying on database dumps.
However there was a brief time period where randomPage used elasticsearch to get the random article instead.
Maybe a hashing function could work.