I'm an undergrad in ECE in the US, and my program shared much of the coursework of a CS major and focused on topics such as operating systems and networking. Would it be considered "directly related to major field of study" if I start OPT in a SDE role for web apps after graduation?
Why not? Lots of the most brilliant SWEs are of EE/ECE background. You know Berkeley has both EECS (engineering) and CS (L&S) majors, right?
It depends of the degree. There are ECE departments as someone mentioned Berkeley. But they offer BS/MS/PhD in CS or EE and so on. Rare to see BS/Ms in ECE but exists. In that case you should be fine.
If you have a good lawyer, you will be fine even with an arts/literature degree.
Yes, it is directly related
Yes
Should be fine.