When does ecosystem engineering cause invasion and species replacement