Okay - all done!  The stack now looks like "12345L10".

I tested it on my production install (32k photos, 1k albums), and it worked like a charm.  In fact, the MPTT part of the task is now blisteringly fast... any further optimization here probably isn't worth our effort.  Rebuilding the path caches, however, is painfully slow...