There's a trope in recent Star Wars productions of treating droid characters as expendable. Spoilers follow...
|Still made it as an action figure|
The modern trend of killing off droids started with Rogue One when K-2SO died a heroic death fending off storm troopers. K-2SO provided some much needed comic relief in a film that explicitly aimed for bleakness so his demise was a sad moment in the story.
Admittedly the whole point of Rogue One was that just about everybody in the film died so K-2SO wasn't particularly singled out, even though he was shot to bits with multiple blasts before any of the other main rebel protagonists were killed.
Then we had Solo, which I enjoyed as a movie even though it's rare to find anyone else who liked it. In Solo, Lando Calrissian has a droid called L3-37 (Leet) who has all of the best lines and accidentally launches a robot uprising. Then L3-37 gets destroyed although, weirdly, its droid consciousness gets uploaded into the Millennium Falcon.
In the first season of The Mandalorian, the repaired assassin droid IG-11 is programmed to be nanny protector of Grogu (the Child). After shooting through a batallion of Imperial soldiers, IG-11 blows itself up to enable the Mandalorian and companions to escape the clutches of Moff Gideon.
And in the recent Obi-Wan Kenobi series, there is, briefly, a loading robot that has joined the nascent Rebellion called NED-B. The interesting aspect to that is the way it is presented as being NED-B's choice to join the movement. NED-B is destroyed while shielding a fellow rebel from gunfire.
In the first episode of Andor, we met a new droid called B2EMO.
I am very worried for the safety of this droid! I doubt it will survive the series.
It's not as if human characters in Star Wars shows or films don't die sacrificial deaths - that started with Obi-Wan Kenobi in the very first movie. But when there is just one droid character in the main cast and that droid character is killed off almost every single time it begins to feel like they are considered more expendable.
Of course, there are other limitations in play. Prequel films and shows are always going to have characters that have to survive. There is no suspense when Obi-Wan and Princess Leia are on the run from Imperial Inquisitors. We know they will survive. Similarly in Solo, we know that Han, Chewie and Lando make it through whatever shenanigans happen, so the odds were always stacked against L3-37.
Prequels also have to deal with the reverse problem as well, and provide a reason why certain characters don't appear later on in the story arc. One of the many franchise loopholes that Rogue One tried to clear up was the removal of Saw Guerrara from the wider story. He was introduced in the Clone Wars series and appeared in the Rebels series, but wasn't in the ranks of the Rebel Alliance in the Original Trilogy. So that loose end got tidied up.
A few people, who take things more seriously than perhaps they should, have questioned the exploitation of sentient machines in the Star Wars universe. The use of 'restraining bolts' and wiping droid memories show a lack of respect for droids even if they seem capable of emotions like fear, loyalty, bravery, pleasure (in receiving an oil bath) and so on. They are able to feel pain - as the torture chamber in Jabba's palace illustrates. But even though they are intelligent and have feelings, they are denied any rights or self-determination - something that L3-37 protests about.
Droid rights probably isn't something that's on the agenda of Star Wars scriptwriters. B2EMO might yet be saved by its cuteness - like R2-D2 and BB-8 who are indestructible by droid standards. However, I'd advise not getting too attached given the current habit of treating droids as expendable characters.