A question then shouldn't there be a fail-safe system/computer that should take over if a pilot mistakenly touches the stick or throttle control, therefore nullifying the pilot command which may have happened by mistake?
The main issue/problem is that you have to determine which flight conditions (plural) warrants some exclusions of pilot commands.
Ex: When I lower the landing gear handle, the F-16 will automatically changes gains because extension of the landing gears system means one thing: TO/L condition. The TO/L flight condition is a critical condition where the airplane is in its most vulnerable state, so by changing gains, the flight controls system reduces, not eliminated, some commands that can put the jet into out of controls state.
Another critical flight state is air refuel.
AIR REFUEL Switch OPEN Opens slipway door. Places FLCS in takeoff and landing gains when airspeed is below 400 knots
Another is ground collision avoidance. Way back in high school when I was learning how to fly before I joined the USAF, a dive is a legitimate flight maneuver to reduce altitude, but so is reduce throttle. Less power means greater effects by gravity. So if we observe the Cessna 152, we will see the airplane in a fairly horizontal in profile but also clearly losing altitude. If I push the yoke forward, I just altered the airplane's profile -- nose down. Now am losing altitude. Am I coming in for a landing? Or am I executing a maneuver to avoid bird strike? Both maneuvers can produce a common outcome: contact with the ground. One just happens to be worse than the other. Common sense says losing altitude and airspeed with a neutral profile is most likely TO/L while losing altitude, gaining airspeed with a nose down profile is most likely bird strike avoidance. Most likely, not definitely.
So how can we make the airplane tell the difference in order to create an automatic ground collision avoidance maneuver that will completely exclude pilot command?
Remember that if I reduce throttle I lose altitude but maintain steady profile. What component monitors this? The gyroscope. So if we program gyroscope inputs into the ground collision avoidance algo, we can eliminate the TO/L flight state from that algo. Getting more complex mean the flight controls computer (FLCC) will constantly monitor airspeed, altitude, gyroscopes, accelerometers, and cockpit commands over time and determines that the cockpit must be excluded from the decision making process and the FLCC will override cockpit inputs and execute a pitch up maneuver to save the jet.
Going back to the latest F-35B mishap...
Obviously, the F-16 cannot hover, so the F-35B will have additional flight states unique to it. We want the pilot to still have full authority over his jet, but we also want his jet to be sort of 'conscious' of what it is doing versus what the cockpit want to do, just like ground collision avoidance. Hovering does not mean requiring losing altitude. Hovering means TO/L, but in this flight condition, there is practically zero airspeed and altitude. This TO/L flight condition is not found in the F-16 and any other 'regular' airplane. The pilot may need to move forward and gain some altitude slightly to get a better parking spot. So we
DO NOT want to exclude cockpit commands, unlike ground collision avoidance algos. His altitude is too low so the descent rate over time will be too short to have any meaningful calculations that there is danger to the jet. In one TO/L event, the pilot may want to descent 1 meter/sec but in another event, he may want to go 2 meters/sec. In a hover, all flight controls surfaces are quite useless, so landing via throttle is pretty much the only way.
So in this mishap, that bounce is critical. The altitude gain from that bounce is -- my opinion -- not normal. That altitude gain hints that the throttle was not reduced. The nose down profile is probably from that bounce which unfortunately directed some engine thrust to the rear which then drove the jet nose first into the ground. But then the jet continues to slide while on the ground so that hints even more that the throttle was either mechanically stuck or pilot error. But the throttle being mechanically stuck is not as tenable as one might think because the pilot was able to reduce thrust enough to lower altitude in the first place. Then the bounce came. So it looks -- initially -- to be pilot error. I have no problems being proved wrong after the mishap investigation.
There are limited situations in your question, and your question is a legitimate one, that we can override the cockpit. Yes, we can affect airplane responses via gain changes, but completely eliminate cockpit commands is extremely rare.