If you tell recruiters "this role can only be filled by someone 40+" it immediately forces that competence filter within those bounds. If there is a lot of under valued talent there that could be a strategic hiring advantage.
Obviously don't do this for all roles, but some age restricted 'tribal elder' roles or something for each team would be interesting imo.
But you don't need to discriminate on the reverse direction, and doing that is probably harmful.
It was mostly a thought experiment about how a software company could gain a hiring advantage in a clever way (if old people are undervalued by the market for dumb reasons). At least in the case of age the categories are clear (as opposed to more nebulous socially defined groupings of people).