The F-35 IS expensive _per_unit_. The A-10 does one job, and there are several other aircraft that do different jobs. So the A-10 sits on the ground while there is air-to-air taking place, waiting while another aircraft handles that. IF the F-35 does four different roles, replacing four different types of aircraft, that cuts the effective cost by 75%. It wouldn't be parked on the tarmac waiting for a time when CAS in needed with uncontested skies. It could, supposedly, when the skies while also bombing enemy airfields , then do close air support.
Let's see how it actually does in testing before we declare the result.
The thing is, the US has never fought a war where it did not need close air support. Ever.
So having a dedicated aircraft for this role seems like a really good idea. Especially when it is 1/8th the projected cost of the F-35.