Make sure middleware layer sorting is stable

See https://github.com/strongloop/strong-arc/issues/767