I don't think in the case of strings/alternate dimensions the theory is really molded either to the math or the math is molded to the theory. The math shows a minimum of 10^500 possible mathematical outcomes.
I could be wrong.
The $$10^{500}$$ number doesn't mean string theory predicts there's that many alternative universes existing 'somewhere else'. It means that there are that many possible configurations our space-time could take and still have, approximately, the sort of properties we see in the universe. In physics you can often get multiple solutions to a problem but only one of them is physical.
As for the number itself you have to bear in mind that its done in an extremely arm wavy way and doesn't take into account various things.
First and foremost it doesn't actually count configurations with
precisely the properties of our space-time, it counts ones nearby. For instance, we don't live in a universe with unbroken supersymmetry but its much easier to deal with constructions of a supersymmetric universe. We don't live in a universe with
exactly zero cosmological constant but its much easier to deal with constructions with zero cosmological constant. All of these are included in the counting of the possible vacuum states.
Secondly, much work has been done in the realm of vacuum state construction, particularly using flux compactifications. This is my personal interest area, my PhD was in it. One of the great things about string theory, which other quantum field theories don't have, is the wealth of symmetries in it. A set of dualities known as T, S, U dualities and mirror symmetry arise in string theory. What they do is relate two entirely different physical constructions and demonstrate they are the same thing looked at in two different ways. It's been demonstrated that there are sets of vacuum solutions which are just reformulations of one another, their dynamics are fundamentally the same. This isn't just "Oh these two are the same" but you can construct entire parameterised families of vacuum solutions linked to one another by duality reformulations. Myself and two collaborators did precisely this for a set of isotropic toroidal Type II compactifications, resulting in connecting dozens, even hundreds, of superficially different vacua to one another. In fact you end up reducing the number of possible vacua to a set of equivalence classes and then you can examine a particular member of each class and derive all the properties of every other member in the class. The collaborators I just mentioned wrote a couple of papers using such techniques to demonstrate a few 'no go theorems'.
After working on that particular case I went on to work on the more general abstract cases where you considered all the dualities. Once you start combining things like T, S and mirror dualities (though mirror is a particular combination of T dualities) you get
further symmetries not evident in any of them separately, reducing the number of independent ones further.
This is in its infancy of development, much of the interesting stuff happens in the poorly understood strongly coupled regime, but it means the actual number of independent "We really can't tell which one of these is the right one" solutions is
vastly smaller than the $$10^{500}$$ so often mentioned.