It doesn't prohibit "stacking" but the 404.8 rule concerning the highest breaker being no more than 6' 7" would likely come in to play on 42 circuit panels.
Not what the OP is asking about, but I’ve seen manufacturers stack panels over transformers in prefab gear, not a very good design, as the heat from the transformer raises the ambient temperature of the panel.