And you think that any future war will involve dogfighting and not planes using missiles from 200 miles away? Or that drones, which can pull off maneuvers that would leave the fittest human pilot unconscious, won't be able to rival the best manned aircraft?
Much the same arguments about the obsolescence of the dogfight is why the F-4 was originally delivered without a gun. But even assuming that be true, for CAS missions, being able to strafe the enemy, especially the enemy in close proximity to your own forces, is an important capability. The main flaw with the F-35 is that it tried to combine too many mission profiles, especially S/VTOL capability, into the same airframe. At this point in the development cycle, it's unclear that seeking a replacement for the F-35A and C could be done in a timely or cost effective manner, tho hindsight makes it clear that those missions should not have shared the same airframe as the F-35B.