Entanglement generation resonances in XY chains