Physicists tend to believe that there are some fundamental principles that control how the universe works, and when we construct theories like the Standard Model we generally construct those theories to include what we believe to be the fundamental principles.
In the case of the Standard Model the principles are that the universe obeys certain laws of symmetry that we call gauge symmetries. The Standard Model is in a class of theories called quantum field theories, and there are an infinite number of possible quantum field theories. There are also an infinite number of possible gauge symmetries. So there are an infinite number of models that could describe the universe.
So given the infinite possibilities where would physicists start? Well we usually look for the simplest possible theory that seems to match what we see when we look around us. Then if the simplest possible theory doesn't work we look for the next simplest and so on. In the case of the Standard Model it isn't the simplest possible theory, but it's actually pretty simple. It uses three gauge symmetries $SU(2)$ and $SU(3)$ (though complicated reasons the $SU(2)$ symmetry gets split into two parts $SU(2)$ and $U(1)$).
And once we've found these symmetries they place limits on the number of particles. For example the $SU(3)$ symmetry means there can only be eight gluons and the $SU(2)$ symmetry means there can only be four electroweak bosons (the $W^+$, $W⁻$, $Z$ and photon). So when you ask:
Does that mean there is mathematically only a limited number of possible fundamental, if not foundational, particles?
The answer is that if we have correctly identified the gauge symmetries then yes these symmetries do provide some limits on the number of different particles that can exist (see below for why I emboldened the word "some"). But it's important to understand that we don't know why the universe has those particular gauge symmetries i.e. we don't know any fundamental reason why the universe couldn't have different gauge symmetries. Trying to find those reasons is what keeps theoretical physicists up at night.
Anyhow, let's get back to the "some limits" I mentioned about. Even with the gauge symmetries there are other ways the number of particles can increase. For example the particles seem to come in three families, where each family contains two quarks and two leptons. But the gauge symmetries do not place an upper limit on the number of families and hence there could be infinite families and therefore infinite numbers of particles. We have experimental evidence that there are only three families, giving the six quarks and six leptons in the Standard model, but we don't know of any fundamental law that says why this is so.
Plus we can add extra particles that aren't in the gauge symmetries we know about, usually by specifying there can be other gauge symmetries that we don't know about. For example there have recently been suggestions there could be an extra $Z'$ particle, though the jury is still out on this. In principle you could add an infinite number of such extra particles, though you'd have to control their properties carefully to make sure we couldn't have detected them yet.
In general adding these extra particles makes our models more complicated, and this sits uneasily with the general belief that if there are fundamental laws they should be simple. So I guess the bottom line is that if we are correct that the fundamental laws are simple they constrain the numbers of particles. But the universe could be sneakier than we think and there could be infinite numbers of particles that we just haven't detected yet. At present we just don't know if this is the case or not.