I think it's in fact just a plot device. It's just unrealistic to have e.g. science or medical staff being able to better fight someone than trained security (take Spock or McCoy for example; sure, some might be worse, but they seem to be better than any of them, no matter whether they have to dodge blows, shots or anything else). Even if that'd be the case, why don't they replace bad personnel?
Different question: Why are they "red shirts" at all? Throughout the series there are at least a few occasions where red shirts are killed by non-energy weapons and there are obviously enough species still using some kind of kinetic weapons (classic guns, arrows, darts, etc.). Yet no security officer is ever seen wearing some kind of protective armor (excluding Enterprise). Even if it wouldn't fully protect you from getting shot by a phaser, some protection sounds better than no protection at all. Today's soldiers aren't fighting naked just because the "bad guys" got armor piercing rounds anyway.
But the whole thing isn't TOS only and by far not only related to red shirts:
The most common reason for any ship in Star Trek to blow up seems to be the warp core breaking (or more specifically the fields keeping everything where it should be). Holes in the hull, structural problems, etc.? Yes, they appear from time to time, but most often it's just some random hit, followed by "oh no, the warp core is breaking!" Don't get me wrong, I'm a big fan of most Star Trek series (probably excluding DS9), but are they really that dumb? They can travel faster than light, travel back in time, create things out of thin air (okay, energy), beam around, etc. but they can't improve the obvious weak point of pretty much any ship? I don't think so. If you've built a tank and it can be killed by a precise shot to blow up its fuel, I add even more armor in that section. With force fields and stuff this should be even easier.
And another example on a more direct combat related thingy: Fights in corridors aboard starships!
These are pretty common in some seasons and series, especially in TNG and Voyager. More or less classic gunfights onboard spaceships. People getting shot, boarding crews rushing through corridors, etc. people having to dodge shots while trying to get wounded people out of harms,... I think you know what I'm talking about.
Other episodes there's some bad guy (or somehow influenced crew member, like Data) trying to escape the ship. Noone is able to get a hold of them, because they're protected by force fields established throughout the ship, always encapsulating the fleeing person. This sounds like a perfect solution for any "only one man to rescue the ship from boarding party" scenarios, yet it's never used. Picard, Janeway, the Doctor, etc. they all rush through tunnels, dodge shots, sneak around, etc. Why don't they use these force fields? They're probably useless vs. the Borg, but other enemies like the terrorists trying to takeover Enterprise during some cleaning action in a starbase? Very odd...
With all these examples, I clearly think such things like red shirts getting killed over and over again or doing stupid things are really only plot devices. Don't even think about it. It might be related to the time some series got created (especially in the case of TOS), but it also happens in later episodes. I don't want to call it bad writing or anything like that, because most often there's no better solution to sell some situation as threatening, despite it appearing rather poor, when analyzed.
Or, to get back on the initial question: They are trained and they should be considered good, it's just required to kill one of them and kill them fast (without always trying to come up with some kind of ambush situation or anything like that) to not waste show time, while showing the threat of death to other crew members.