Yes, absolutely identity matters. It may not matter to every single woman (or it may matter more or less to some), but identity is integral to how we perceive the world and our place in it. If our identity doesn't match a certain career path, we are less likely to get on it. This is no different for women who want to pursue STEM, but don't.
Citation: Kim, A. Y., Sinatra, G. M., & Seyranian, V. (2018). Developing a STEM identity among young women: A social identity perspective. Review of Educational Research, 88(4), 589-625. https://doi.org/10.3102/0034654318779957