Do you know why that would be a positive evolutionary trait? Clearly, if they try to retract it, at some point in the history they must have been able to do so.
Because bee stingers are mostly used against other insects. They don't get stuck in a chitin exoskeleton, only in the more flexible skin tissue of mammals. In insects the barbs instead pull out soft tissue from inside, thus making them more lethal (to the bees victim).
It makes it more dangerous : the sting is attach to the venom bag, so the venom bag gets to empty itself whole if it stays. Evolution would have chosen the survival of the hive, not the survival of the bee.
One thing is weird though : you can extract the sting of a wasp with a pincer. The wasp will live through it. Why do the bee dies when it loses it's sting and not the wasp?
That doesn't even make any sense if you stop and think about it at all. Sure, a single worker bee dying isn't a huge deal, but they all do that. It would definitely be better for the hive and the queen if they didn't rip their own guts out.
but worker bees generally don't have to sting anything, the amount of them that do have to do so is low enough that it's not a big issue, and they have probably gotten work done before dying anyways.