If the ecu is hunting for an O2 sensor reading this indicates that the engine or ecu has been changed, as O2 sensor is not available in PKDM civic. Anyhow this problem is not directly linked with the rpm fluctuations especially in post rains scenario.
For RPM problem you need to check these two things:
1. Shift position signal(s) to the ecu
2. Idle air control valve (IACV/ EACV)
For shift position signal troubleshooting you have to access the ecu to check issues with the wiring.
Testing IACV is rather easy, while the engine is started remove conenctor from IACV and see if the RPM drops. If it does, the IACV is not dead, though it may need cleaning from inside. Switch off the engine and reconnect the conenctor, also remove the battery negative terminal for 10 sec to clear the IACV code.