BadNewsRef wroteI'm guessing the reason the violation by a teammate of the shooter kills the shot is because if the shot goes in there would be no way to penalize the violation.
A foul by the shooter's teammate on the other hand comes with the penalty of one personal foul charged to the offender and possibly free throws for the offended team.
That's the best reasoning I've heard for these rulings. And yet, I still have never seen either called - the going OOB during a teammate's shot, or swinging elbows, by a teammate. Of course, neither happens very often, which contributes to the rarity of such calls.