The idea of a math alphabet is to provide digits and basic alphabetic characters of a specific design in a formula. While most characters in a formula have a fixed representation (i.e., are taken from a fixed symbol font) the digits and the alphabetic characters can vary their appearance by selecting a different math alphabet.
Technically speaking each symbol in a formula comes from one math family (of fonts) and there are a maximum of 16 such families. The speciality is that some symbols can be marked as "variable symbols" so that they are taken from the math family associated with a math alphabet when they appear within the scope of a math alphabet command.
What math font families are associated with what fonts can be changed on a per formula basis (this is what
\boldmath does it changes the mappings to bold fonts) but within a formula the association between math font family and real fonts is fixed.
For symbols that are taken from "symbol fonts" out of fixed positions one has to define the math font family up front because these commands like
\timesare just defined as "pick up the glyph of math font family X in slot position Y". The situation with math alphabets is different, when they are used for the first time they can make the association between a math font family and some external font and then select that math family and use it.
That doesn't get us around the maximum limit of 16 math families but it allows us to offer more alternatives and choose among them only when actually used.
So much for the general background.
Now, if for some reason a math alphabet should actually be constructed from more than one font (e.g., the digits from one font and the letters from another) then there aren't many options available to implement this:
the probably most efficient way to do this would be to construct a virtual font that combines the glyphs from the two fonts in the way wanted. As a result to TeX we end up with a single font which needs a single math alphabet.
If a technical solution within TeX/LaTeX is intended then the only way to achieve this is along the lines suggested in the question, i.e.,
- locally turning one group of "variable symbols" into fixed symbols pointing to a symbol font.
- that symbol font however has to be available as a separate math font family so unless it is already loaded for some reason one has to declare it (upfront) and this way blow another math family
- another downside of the approach is of course that all those redefinitiions have to happen each time
\mathbf is used ... fortunately computers are faster these days.
So bottom line the approach in the question is by an large the only one within TeX (of course the implementation could be done differently). A much faster solution would be to define two math alphabets one for bold letters and one for bold digits (avoiding the internal remappings) but if the idea is to pretend that there is only
\mathbf and the change of fonts is only there for some aesthetic reason (which could be a valid reason enough) then the above solution or the something similar or the use of virtual fonts is the way to go.