Arduino + ESP8266 electromagnetic interference
Put that radio module close to the MCU while still connected via the ribbon cable. If it stops working, it really was radio interference (but I doubt it). If it still works, then it's something else. Maybe you have transients which are reduced by the cable. Maybe you have connections which are unaccounted for when you plug the module directly (the cable has 6 poles, while the connector has 8). Hard to tell without a schematic, really.