It's just bad writing.
This episode is full of it. For instance anything as complicated as a starship is going to be internally vulnerable to sabotage by its chief engineer. And the idea that any system could bypass manual override means it ain't actually a manual override.
This one nails it in a nutshell for me. In many cases, Scotty, being the Chief Engineer, and clearly in love with his ship, would have a multitude of suggestions to bring to Kirk and Spock to try to fix a problem. It always seems it is either Kirk or Spock who comes up with the suggestion. I know it is the confimes of a TV show and Shatner is the star, so Kirk will always come up with the solution - but it just ain't so in real life. It's shit like this I just have to let slip by and keep on just enjoying the show. I don't think that would be the case if it were being written today.