Would the compiler not allocate the memory contiguously on the heap in that case then? Seems like a reasonable thing to do.
Nope. The C++ memory models is designed around no hidden/non-deterministic memory allocation.
If you try to allocate 10MB on the stack, that's the dev problem if the program fails, it's not the compiler job to guesstimate whether something will fit there or not (and it's impossible anyway, the compiler can't know all the stack sizes a program will ever run on).
If it fits on the stack, yes.
Typical code using MD-arrays is scientific code, and the data they manipulate generally do not fit there.