How the heck does this work (the Crudest possible way of switching a relay with ESP 01s works!)

Hello @indrajithgamage
You use a a lot of words to tell us very little, I gave up reading. Please see How to get the best out of this forum
We need code and a schematic and a description that gets to the point of what you are asking.

Thanks,