"Blackhawk Down" If you lose even one aircraft crew as we did in Somalia, you may be forced to retreat from the entire war. So it makes sense to spend 10x to go from 99.9% -> 99.99% safety.
"Battle of the Civs, Proxy war edition": Fighter planes are less relevant to hugely asymmetric warfare the U.S. is engaged in, and expects to engage in the near future. These fights consists of the most advanced military technology against insurgents with machine guns and RPG's. Clearly drones are better in this area, and Missiles of all classes bring more destruction and accuracy to the traditional fighter role of deterring the threats of advanced weapon systems against your ships/bases.
However in the smaller proxy wars of e.g. Syria, Ukraine a traditional fighter jet still makes sense, and in fact could be a crucial deciding factor. So what the F35 program is doing is building a machine that can give a strong advantage in a regional war. And by controlling the access to the machine, the U.S. gets a say in the conflict without entering it.
"Terrorist hideout or hospital?" - collateral damage has always been a part of aerial combat but bad PR seems to do be especially discouraging to today's democracies. So weapon systems have to be even smarter and more precise.
"Software is eating the world" - As others have mentioned this is at least an order of magnitude increase in software functionality over the F22. And yes, an autonomous vehicle will probably be the main aircraft in the fleet in 20-30 years. So the F35 is this kind of avant-guarde experiment in how to structure contracts, maintain and deploy weapons which are primarily based on software.