Pythagoras is believed to have come up with the just intonation (exact rational) figures. At the time, irrational numbers were distrusted and despised so, as you noted, the perfect fifth really was exactly 3:2.
But it’s likely that a 12-tone system won out because lg(3/2) is so close to 7/12, even if this was never a conscious decision. 19, 31, and 53 are also credible candidates per continued fraction expansion, but unwieldy for physical instruments (although some computer music does use 53-TET).