I think you've discovered a Visio bug. I was able to replicate the problem. Indeed, the z-order does not stick. It seems to be a code related issue.
If I replicate the steps manually, then the z-order remains correct. The steps:
1) created grouped shape, saved to new stencil. Drag and dropped to drawing page
2) selected subshape and duplicated.
3) saved subshape to same stencil
At this point, file is setup to do the code drag/drop/add to group step, set position, set z-order. Save. Close Visio. Open Visio, saved file. And z-order is messed up.
Return to ground zero: page with just group on it. Now, manually
1) drag and drop.
2) reposition to desired location
3) send subshape to back
4) select group, then subshape, then add to group. Everything is as desired.
6) Save, exit Visiol, open Visio, reload saved file. Opens as expected and desired. Z-order was preserved.
That's as far as I've gotten.