Let's look at the gun for example.
There's a small door that opens so the gun can fire. Apparently for stealth reasons. The opening door creates an aerodynamic disturbance and the plane yaws or does something else and the aim is off. So that has to be corrected in the flight software - the plane must countersteer with the tail surfaces when the door is opened. And for some reason it's been very slow to create these rules.
Now, let's assume the F-35 program is canceled. There's a few scenarios after that.
Maybe some non-stealthy aircraft can be created for ground support missions. They don't need such pesky doors. On the other end of the spectrum, maybe some stealthy pure air superiority fighters or strike craft can also be created that don't need guns at all.
Or then you decide that you need a gun on a stealthy aircraft and you need a door again (or then you design it differently, AFAIK the F-22 doesn't have such problems). Will it be easier this time? If you think it will, what will be different? Why does it take years and years to develop software for F-35? Why wouldn't it take years and years, and actually longer for these new aircraft?
The gun problems are probably not caused by the "commonality between different versions", that's always trotted out as "the fatal flaw in the program", as it only exists in one version of the aircraft.
There might be some underlying reasons why progress is slow and expensive. But I don't think many of them would be fixed by procuring just a new aircraft. Maybe the department of defense could buy from Northrop or Boeing... but I doubt the results would be that different with a roughly similar process.
I would likely look at radical software development methods (would still have to be safety conscious). There are things like Skunk Works, Faster Better Cheaper, Agile Manifesto... two out of these three are from the aerospace world.
They don't last forever because the small group of competent people will always turn into a huge mass of mediocre people governed by a mass of bureaucrats. That's just nature.