This is a new take on #89111. Now that #90040 is merged, this has become trivial to implement. The added test shows the kind of benefit that we get from this: now dim-of-expand-shape naturally folds without us needing to implement an ad-hoc folding rewrite.