Because whether intentionally or not, they have allowed racial characteristics to inform their hiring decisions. We have a word for people like that. But that's not the point I want to stress.
As you correctly note,
If that information plays no part in the hiring process, why gather it
There is no answer to that.
There's also a difference when gathering that data before, or after the hire. If they gather it before they hire you, there is no reason to think that it doesn't play a role in the hiring decision. To put it another way, a company that uses that data before hiring is indistinguishable from a company that doesn't.
As a sidenote, when a company says that
employment decisions are made regardless of [list of] characteristics protected by law
it is also impossible for you to verify whether they lie about that, or not.
As others have noted, while there's no rational reason to gather this data in the context of a non-racialised society, it could be a legal requirement. In fact it is in many places.
Still this answers the cause, but not the reason of why they gather that data. The reason is: Unfortunately, those Western societies which have enacted such laws have legally allowed race (and other demographic markers) to play a part on how we treat people. Again, we have a word for such behaviour. This decision undermines what was achieved by the Civil Liberties of the '60s in the US and elsewhere.
Now I have to take a moment to answer some comments I can foresee being written. The overarching theme in my answer to those hypothetical comments is: The road to hell is paved with good intentions. I will elaborate.
- (a) There is historic racial inequality and (b) people of X race must be given a chance to catch up. Therefore, (c) we must preferentially hire people of race X so that they're brought up to speed.
(a) True, (b) true, (c) is not self-evident. I don't see how these rash, short-sighted, and short-term solutions will undo a problem of generations. They are rash because any attempt at discussion will brand you a racist if you're in disagreement. Therefore, no proper dialogue has been established in the common discourse. They are short-sighted because they lack any sort of analysis, and fail to account for the problems they are going to create. They are short-term because... well, we want a solution and we want it now.
One solution that I apply myself is the following: Treat people according to their actions and not according to their demographic. This is antithetical to law, as it stands.
- Preferential treatment of people from a non-dominant demographic is ultimately good to society, even if it causes short-term harm to the dominant demographic.
Again, not self-evident: How do you define when to end the regime of different treatment? How long is short-term, and how much "short-term" harm is acceptable, before we can agree the idea has gone too far? Finally (and most crucially): Why should anyone, from any demographic, allow themselves to be treated differently to anyone else?
When I listen to those activists who push such ideas, I'm left with the impression that they'll only be happy once the injustice inflicted on the non-dominant demographics is replicated entirely on the dominant demographic - and then some - for good measure. It is easy to see how this will lead to nothing but resentment - some of which will unfortunately be placed on those demographics granted preferential treatment. It is unknown how much damage this will do, or how it would be quantified, but the potential for severe damage is clearly there. To at least define the maximum of this hypothetical, one outcome might be a regression to a state before the Civil Liberties movement. I consider this unlikely, but not unfathomable.
By the way, earlier in the answer I said there's a word for that. Did you find the word yet? It's racism. Treating people differently based on their race. That's what the word is.