Hydrogen vs. Battery Electric Cars

Why we are not considering energy consumption and pollution caused by making of batteries and and fuel cells.
And rare earth elements which are needed for making them. We should consider sustainability of these also, otherwise we would be making same mistakes as by burning fossils