ESP-3 is, at the moment, capable of detecting the state of the door switch wired to GPIO5 and operating a relay which is connected to GPIO2. You now want to add a new action so that GPIO5, in addition to triggering the relay, also sends a command to ESP-1. Is that right ?
In that case, you are simply then using ESP-3 as a web client of ESP-1. It [ESP-3] has to read the state of GPIO5 in the loop() and, if a status change has been detected, issue an HTTP GET command to ESP-1 to notify it of the new state, maybe by sending the URL "Http://192.168.0.20/X/ON" or "Http://192.168.0.20/X/OFF" as required.
It would be good to post the sketches that are running in ESP-1, ESP-2 and ESP-3. You'll probably have to use an attachment for each .ino file because of th limits on code tags.