I don’t expect the 3.1.1 firmware to work with a replacement module ESP32 that is in the D1 pinout. I expect the Arduino code is going to use the pin numbers for the SMD ESP32-C3 chip, but the D1 pinout version will have different pin numbers.
I know the ESPHome version wouldn’t work with what is out there now, since the ESP32 based config have different pins from the D1 Mini based version, but it needs to be compiled for the proper chip. It could be done, but I haven’t got the chip, and haven’t tried it.