It does seem reasonable that some of it is kept confidential if not actually required.
It doesn't matter whether or not the software is required for current functionality of the aircraft. Especially if the software is currently essential. That means its security is important.
In addition to security issues, there are property rights to consider.
The RAF or MoD doesn't have unlimited rights to modify the software. Neither does the USAF or the USN/USMC, without additional negotiations and payments due.
I'm quite sure that UK contracts for purchase of C-17's, C130's, F-4's or Douglas Dauntlesses have not included unlimited rights to modify things, at least without voiding warranties.
There's this tradition of Anglo-Saxon law and precedent. Or maybe that tradition is becoming obsolete because Anglo-Saxons are becoming obsolete, in the New World as well as the Old. From each according to his ability to each ... That's the new order, right?
If UK people want to hack F-35 systems and thereby void warranties, I suppose the UK is free to pursue that option.