If you're willing to add even more changes, this should be commutative.
Nit: Include in the description that you added assemblyFormats for these ops.
Nit: Change commit description to say "Fold shape.broadcast with at least 1 scalar operand" or similar since I read that as both being scalar.
This test would have behaved the same before your changes because both are constant. I think the example above with the order of inputs flipped would currently fail.