Modulation-resonance mechanism for surface waves in a two-layer fluid system