A worse story yet is that a cobra climbed over the leg of my wife's dear sister in India while she was sleeping, but then slithered away uneventfully when the sister awakened with a start. It is not that unusual there to find a cobra in the house. There was never any threat display.
Cobra’s only stand up and flatten their neck when they feel threatened. Those so called snake charmers playing musical instrument makes the cobra sway...it is not the music, it feels threatened by the instrument swaying in front of it’s face.
I grew up in India and snakes indeed slithered in the house on occasion because we always had the doors open during day. But if you ignored them, they never attacked or bite. Very few snakes will attack humans unprovoked except the black mamba of Africa and one or two other rare species.
You are correct that if one steps accidentally on a snake it is going to bite you in reflex action. So one has to be very careful walking in brush known to be infested with snakes.
My father had a farm business and we have seen 15 foot long cobra’s in the fields. They are farmer’s friend because they keep rodent’s under check. So the snakes were left alone.