This logic is flawed because not all environmental issues are the same priority.
If you believe climate change is the biggest environmental issue, batteries could be significantly "dirtier" overall than alternatives as long as they contribute less to C02.