There are severe constraints on mining the metals required for the energy transition. These include accessing the water needed for processing the ore-bearing rock and handling the resulting waste. Mining waste is at present placed in tailings dams which are inherently risky structures, as shown by two tailings dams' disasters in Brazil in the last 10 years (and others).
A transition to sustainably-produced electricity and away from fossil fuels is absolutely required but that leads to many other issues related to mining. Care is going to be required in deciding how batteries are used, as it is unlikely that it will be possible to electrify our transport system like-for-like. Small batteries for rail vehicles to manage small gaps in electrification and for emergency use are a more suitable use of battery technology than large numbers of private electric vehicles designed for a range of several hundred miles.
You are taking two very specific issues for certain ores in certain locations and extrapolating out the whole industry. The key point is that the total volume of materials removed for electric vehicles and low emissions electric grids is significantly smaller than for existing ICE vehicles and fossil fuel grids. Furthermore fossil fuels cannot be recycled, batteries can. Mining can be done ethically and should be, not electrifying things because we are worried about mining only helps oil producers.
As an aside in the 2030 timeframe probably half the batteries produced will likely be sodium batteries which removes the last remotely rare mineral from the battery. Everything else in a battery other than lithium is something which is already extracted at orders of magnitude higher than needed for batteries (iron, aluminum, phosphates, carbon) or something substitutable (copper, rare earths (not in batteries)).
Re: Not electrifying the car fleet:
There isn't an OECD nation where car's share of passenger miles is less than 50% and for most of them the amount is greater than 80% (Even China is over 50% if you lump powered two wheelers in the by road figure). The time frame for fully replacing these ICE vehicles is in the order of;
1: Compound annual growth rates of 30-40% in EV sales (current trend, plus manufacturer new model pipeline), result in all new car sales being BEVs by 2030-35 in all OECD countries regardless of mandates or otherwise from governments. Nobody wants to be left with a rapidly depreciating new ICE vehicle in 2030 as petrol stations are beginning to disappear as they have lost half their demand (and EV chargers fast or otherwise are not necessarily best placed at a petrol station) with a certainty the rest are going in the medium term.
2: Cars only last an average of 14 years and due to a whole load of factors its likely that the last (non-collectable) ICE vehicles will be retired early anyway.
3: This means its likely that aside from a small % of a long tail of stubborn ICE users ICE cars will be gone from most OCED countries by ~2040
All the above will lead to the economic rational to mine a lot of material, make a lot of batteries and build lots of EVs. At this stage its more a question of who wins the above scenario (currently China) than there being an alternative solution. Potentially some issues like lithium supply might put a mid 2020's throttle on battery production, but that only delays these things from happening by 5 years max.
If we are not going to electrify the car fleet what are our options?
1: Massively expand public transport; unlikely; UKs rail is at capacity and usage is basically as high as it has ever been. If we quadrupled rail we'd only knock just over 1/4 off the total passenger miles driven by car, to do this we'd need to basically build an Elizabeth Line every year for the next 30 years. In practice we'd be lucky to plan and implement a single new Elizabeth line by 2040. This also assumes that any new journey by rail is displacing a car trip, I suspect that in practice it wouldn't and a new car journey would replace the one displaced onto rail.
2: Reduce car usage by reducing demand; see induced demand, if we all stay at home and home/hybrid work the road space will end up clogged by latent demand for trips currently assigned lower priority.
3: Densify cities and produce more walkable neighborhoods and 15 minute cities - A laudable aim, you have 20 years.... Given this involves massive house building, infrastructure building, winning abstract political arguments and behavior change my money is that just offering people different (and better) car options when they change their car will be easier!
From a transport emissions perspective the only real lever you have to pull is to electrify light duty vehicles. All other modes are relatively tiny by comparison, even expansion by multiples wouldn't dent car usage. Regarding the point:
Small batteries for rail vehicles to manage small gaps in electrification and for emergency use are a more suitable use of battery technology than large numbers of private electric vehicles designed for a range of several hundred miles.
Let's say we put a 100KWh battery in every rail car that the UK railways procures in a year ~1000 coaches. That would equate to 4 hours of battery production at Tesla.
The reason to add lots of cycle infrastructure and legalise every form of micro mobility, build dense urban neighborhoods, plus build every viable metro/light rail line and build a full high speed network is because it would improve our quality of life and productivity not because it would save the environment.