:4277029 You are very brave trying to run \tracingall there. The code in that which you commented out that causes the problem is \check@mathfonts. Do you suspect that's incorrect, and I need to dig into this code again?
The short explanation of what is happening here is that LuaTeX uses the LAST maths font that is loaded to initialise all the (equivalent of what it uses instead of) fontdimens. But in unicode-math I need it to be the FIRST maths font.