I know it is rather late to respond. What worked for me working with a WEMOS D1 mini and the MH-Z19C was reassigning the Software Pins used SoftwareSerial co2Serial(D1, D2); In that case the second sketch posted works atleast for me.
The problem might be that the ESP8266 uses the hardware serial lines for connection to the USB-to-Serial bridge (usually a CH340 or CP2102 in most designs) which means you might encounter problems if you want to use the same serial line for more than one device.