Suppose a baker has the highest staking balance, and has a few delegations from his own network and now when it comes to bake, he does something against the protocol or edits a transaction to profit him more than what he has deposited as security and he gets accused also so he only loses his security deposit. Then where is the network security? The baker will earn more than what he'll lose as security deposit.
The delegators have nothing to do with the validity of the transactions signed by their delegate/baker. The delegated funds are never at risk and that is why it is always safe to delegate your tokens.
The example you gave of a baker including a "bad" transaction in its block is handled by the endorsers. They will not endorse this block and the bad baker won't get rewarded as each baker in the priority line will have an opportunity to create the block with a set of valid transactions that will gain more endorsements.