The answer would be: secretes mucus that is not identical to stomach mucus
Stomach cell lining is protected by a thick mucus that prevents the acid from destroying the epithelial cells. But the mucus that secreted by the esophagus is different than the stomach. That makes esophagus can't protect itself from the stomach acid.