Can the airlines do that? Surely if the CAA finds you fit to hold a licence, it is inappropriate for the airlines to take your medical history into account? That is what your AME is for. I would have thought that you might have grounds for complaint. After all, a Class 1 licence says you are fit to fly, what right have the airlines to say that you are not?
I can understand them saying that if you have a poor history of sickness absence due to a long-term health problem then that might be an issue but if that were the case, you probably wouldn't get the Class 1.
I am not a lawyer but I would be tempted to ask a legal friend (if you have one) where that sits in the discrimination camp. Are the airlines allowed to ask for confidential medical information?