Need a couple of more steps.
The construction of the square pyramid places the diagonal along the x and z axes. Rotating by 45 degs aligns the mesh rendering but not the underlying structure. Baking the rotation changes the underlying structure (ie resets the vertex positions).
https://playground.babylonjs.com/#C8QNA5#1
Hence lines 30 and 31