You can always claim harm, but proving it is a different story.
Policies like that are based on results of psychological research such as "stereotype threat", which has recently fallen victim to the reproducibility crisis.
In other words, the entire social engineering structure of such laws may be a house built on sand.
Scope matters. On the level of the entire economy? Possibly yes, but you haven't shown that the entire economy will discriminate against X or Y; respective preferences of individual players may well balance out.
On the level of a single Acme, Inc.? What if that particular organization is unofficially hostile to a particular gender? I would say that in such case, it is more harmful to join it blindly and then suffer from the generally unfriendly environment than to steer clear of them in time.
I wouldn't personally like to become an employee in a corporation that prefers not to employ men and is only forced to do so by external powers. And I would prefer them to be honest and advertise that openly, to save my time and theirs from making an unhappy match.
How does what is advertised to you affect your opportunities? Opportunities are things that are available to you. Obviously people can seek out opportunities. They don't have to have them thrust in front of them.
Policies like that are based on results of psychological research such as "stereotype threat", which has recently fallen victim to the reproducibility crisis.
In other words, the entire social engineering structure of such laws may be a house built on sand.