If Alice is underpaid relative to Bob at company X (or for that matter, if Bob is underpaid relative to Alice, or if Bob is underpaid relative to Charlie) then some smart employer from company Y will figure this out and offer Alice a job for slightly more money. Nature abhors arbitrage, and employers won't go round hiring men for more money if they can get the same quality work out of women for less money.
Many facts of life are only questioned rarely. People complaining about gender inequality will cause some of those facts of life to be questioned and that can trigger the kind of reaction that you outline to correct this type of arbitrage.
Bottom line is: The market is not magical. It takes precisely this kind of discussions for participants in the market to become aware of the kind of opportunities that can make markets produce better outcomes.