The Implicit Bias of Heterogeneity towards Invariance: A Study of Multi-Environment Matrix Sensing