The diagram I gave in #6 is correct for the first option; you do not connect the ground to the ESP - at least you do not connect it directly!
But in your project, I suspect you are deriving your 3.3 V for the ESP32 from your 5 V supply. If so, what you need to do is to connect the 5 V and ground as in the diagram in #6 directly to the actual 5 V power supply by a pair of wires, either as a"figure 8" or ribbon, or at least keeping them tied together all the way.
Now you can run another similar pair of wires kept together, from the 5 V supply to the ESP. Then directly from the ESP to the relay module, you run the four "IN" wires plus the 5 V wire (not the 3.3 V) as another group kept together.
You need the 5 V wire and not the 3.3 V line so that you will pull the relay module input down with sufficient voltage to drive the green LED and optocoupler diode in series as shown in the PDF. Note where it says "It may be necessary to change the value of R1 from 1000 ohms to something like 220 ohms, or supply +5V to the VCC connection". Using 5 V is more sensible than trying to change resistors on the board.