Wait a minute. What doctor is going to leave a patient in a semiconsious state when he's using a bone saw on her head? If you were in brain surgery, would you want to be in and out of consciousness while you listened to the whining sound of a bone saw cutting through your head? That sounds horrific! It sounds like something you might see in the horror movie SAW. If the patient partially wakes up during the bone cutting process, she could panic, move around, and then sue the doctor for malpractice for allowing her to wake up during bone cutting.
Don't look up "anesthesia awareness" or "intraoperative awareness" then. It's a real thing, unfortunately.
Let's see if I can break this down for you.
From Wikipedia (I'm lazy, ok?):
General anaesthesia has many purposes including:
Analgesia — loss of response to pain,
Amnesia — loss of memory,
Immobility — loss of motor reflexes,
Unconsciousness — loss of consciousness,
Skeletal muscle relaxation.
In order to accomplish the above effects, several different drugs at differing dosages have to carefully and constantly be administered to the patient by an anesthetist/anesthesiologist who has to figure out (prior to surgery) the combination of drugs and dosages needed based on the patient's body mass index, age, medical record, diet, etc. It is not in the patient's best interest to lie about/omit any drug use (either illegal or over-the-counter) or special diet fad he/she is currently on. Too much of certain drugs and the patient can overdose and die. Too little and... well... living nightmare fuel. Sometimes a patient's health just cannot handle the dose of the drugs necessary for full general anesthesia (for example, huge blood loss prior to surgery), so some things get compromised out of necessity (it ain't a perfect world, live with it).
Note again that general anesthesia does not stop all brain activity. It puts the patient into a medically induced coma, which is not synonymous with brain-dead. Brain activity does not equal consciousness/awareness.
Anesthesiology is not a perfect science that works 100% of the time with all patients (the advances made, though, are astounding). Experiences can range from becoming briefly aware of hearing the doctors murmuring (and then going right back to unawareness), to the patient shifting about during surgery but not recalling anything, to recalling dreams had during the surgery, to feeling full on pain of surgery while unable to twitch a single muscle (and able to recall the horrible details). The latter kind is very rare but makes the headlines. Failures can be due to equipment malfunctioning, the anesthetist being an incompetent human being, patient not following pre-surgery instructions, unknown drug and patient body factors, etc. Monitoring via various equipment (oxygen levels, blood pressure, EEG, etc.) during surgery is done in order to adjust drug dosages as need be.
Just to be clear, several different drugs are used in combination because
no one drug provides all the effects usually needed to achieve general anesthesia. So it is very highly unlikely that failure of the drugs to induce unconsciousness will simultaneously happen at the same time as failure of drugs to induce immobility or the failure of drugs to prevent pain. And the risk of overdosing is very real, so anesthetists can't just give the max amount of drugs and call it a day.
I don't recall Pam complaining about feeling pain, so those particular drugs seemed to be working just fine during her surgery. So you can stop getting upset about that aspect, okay? And not all bad things are the result of deliberate actions, okay?
Now, are you going to ignore the fact that Pam Reynold's case does not qualify as an NDE since her OOBE was during a "brain is still showing activity" stage of the surgery and her life was not being threatened (yet)?