But their stingers are barbed, unlike wasp stingers and other stinger types which are smooth. Barbed stingers seem specifically designed to lodge in elastic skin (that is, skin of a larger vertebrate, not simply mammals) and a barbed stinger can also be more effective at delivering venom, pumping long after the bee itself has disengaged and slunk away.
I don't see how you can call it an "accident" if it's a simple fact that barbed stingers are well-adapted to lodge in the skin of larger victims and stick around and increase efficacy of the attack.
Worker bees themselves are disposable. If we consider an entire hive as the organism, rather than the component bees, we can easily see how the loss of several workers to loss-of-stinger attacks is beneficial to the entire organism, and it really does enhanced survival of the group, or the organism itself, if you will.
the barb doesn’t stick in other organisms that they sting, and still delivers venom
the disposable worker is not disposed and continues working
> we can easily see how the loss of several workers to loss-of-stinger attacks is beneficial to the entire organism
We can't easily see it, especially if on the other hand you have a design that requires no losses. And it's not always "several", especially with bigger predators