The conclusion of your first sentence would be the solution is in the cause - the end in the beginning. If the UK can resolve its identify crisis and understand its reality as a medium sized country in europe then it can begin to make rational decisions.
For instance, if it sublimated its defence to the EU or NATO, it would not need to have a first class army. If it re-integrated with europe (via the EEA, I don't think an EU re-entry will be possible on either end for a long time) then a battery factory in France still enables a UK car industry.
It would take a miracle to align the UK's reality with its self image, but aligning the self image with reality just requires a more honest media.