No. The median is not necessarily unique (just like the mode, and unlike the mean). For more information, you can check here: https://en.wikipedia.org/wiki/Central_tendency#Uniqueness
A median (and not necessarily the median) is any point that minimizes its distance from a set of points under the L1 norm and often you have several points that minimize such distance (such as in the example you provided, assuming perfect 50/50 split between men/women).
> If you look at ten people with 2, ten people with 0, and one person with 1, then the median will be 1.
Correct.
> If you make it twelve people with 2, still ten with 0 and one with 1, suddenly the median is 2.
Sure.
But, again... you are choosing cases where the median of a set of points is unique (odd number of points aligned along a single dimension)... this is the exception, rather than the rule (particularly in higher dimensions than one).
> Across an entire population, I would hazard a guess the median would be 0 or 2 unless the difference in numbers of each sex is small enough that people with 0<X<2 testicles might fall right in the middle of the distribution.
Yes... as I said. The actual median is not 1, but actually either 0 or 2 (because the ratio between men and women is not exactly 50/50). But, again, even in the (rather unlikely) case that the ratio between men and women would be exactly 50/50, the median would still not be uniquely defined as 1 (in such a pathological case, any number between 0 and 2 is a median).
EDIT: after re-reading your comment carefully... I have not considered the subpopulation of people with a single testicle (which is nonzero); so I stand corrected... the median could be 1 (but it is very unlikely that it is the case... it's probably either 0 or 2).