Photoinduced modulation of the excitonic resonance via coupling with coherent phonons in a layered semiconductor