I can see why this would be of concern ... it may depend on whether you have to exit the aircraft and be considered 'landed' in the non-green country in which case the quarantine and testing requirements of that country will apply once you arrive at the UK's point of entry. Not what anyone would want, but the risk is there. Maybe there will be some insurance available in the future to help mitigate unexpected financial expenditure, but life is risky and you have to weigh the odds before you start and that sadly may mean accepting the consequences.
Not perhaps what you might like to hear but ....