I've learned that the top number in the time signature is the the number of beats in the measure and the bottom number is the length of note that equals a beat.
Everybody learns that! It's more or less true but it's also an example of a lie told to children. I mean this quite literally; I believe I was 7 when I first encountered it.
A better explanation might be that the upper number tells you how many time units are in each measure; the lower identifies the units of which you will find that many in a measure.
How many seven year olds do you know who can understand abstract concepts such as "time units"? Add to this the fact that most beginning music students aren't yet playing pieces in 6/8 that are fast enough to be counted in two, and the utility of the given explanation is clear.
The number of beats per measure depends in part on the tempo, and there is a range of tempos within which reasonable people will reasonably disagree about whether, for example, a measure of 4/4 should actually be counted in 2.
The ambiguity is much more common with compound meters, and you will also find more compound meters that are unambiguously on one side or the other of the question. You will also find this with simple triple meters: 3/4 is often intended to be "in one," and Beethoven is well known to have organized different parts of his ninth symphony, nominally in 3/4 but so fast that it must be in one beat per measure, into "supermeasures" of either 3 or 4 bars, using the phrases "ritmo di tre battute" and "ritmo di quattro battute."
One reason for this ambiguity about which unit of time corresponds to the "beat" is that time signatures began their lives as fractions expressing a proportional relationship (see mensural notation if you're interested). Once the modern meaning arose, various conventions and common practices were already well established, and there was no wholesale redesign of the system.
The older system had an ambiguity whereby each level of note duration could be subdivided into two or three parts, depending on the context, based on certain rules. When the rules nonetheless left it ambiguous as to whether a whole note, for example, was to have the duration of two or three half notes, the convention arose of using a dot to indicate that it was three half notes. This was the "dot of perfection," since the triple subdivision was considered "perfect" and the duple subdivision "imperfect."
The dot of perfection led to the modern dot, the dot of augmentation, and the rules for sometimes subdividing into two or three fell by the wayside. This led to the current situation: if you want to write a piece with a two-beat meter and a triple subdivision, you can either write a triplet indication over each beat or write the piece in 6/8 (or 6/4 or what have you).
Sometimes, in modern scores, you might see the bottom number of a compound meter replaced by a dotted quarter note (or dotted half note, or what have you), but this practice is far from universal.