Magnetoelectric effect arising from a field-induced pseudo Jahn-Teller distortion in a rare-earth magnet