Imagine, the character you wrote that had genuine bond with the MC across different chapter.
You planned to kill him off someday.
That day arrives.
What's your first reaction?
I did that in my debut novel, but I didn't plan to kill them originally. I don't even know why, but she got on my nerves at some point during the wirting process, so I offed her. It worked out well. I felt better afterwards.
But aside from that, I rarely kill off people that are important to the character AND might be important to my audience. Reason? Is an audience member to many other stories, I hate it when that happens. And the whole "someone dies to inspire / motivate MC" may be tried and true, but also well-used. It's not like it's such a brave thing to do. There's a difference between a story that constantly shows fake-out deaths and a story that has no "important" characters dying as well.
"Important" is a relative term.
A famous example:
Ace in One Piece was surely set to die the moment he appeared for the first time in Alabasta. I say it, because I felt this might happen, even way back when I was quite young. He was introduced as someone extremely powerful and cool; somone, Luffy clearly looks up to. At the same time, he's not just the member of a rival to Luffy's goal, who's way better equipped to reach the finishing line than our MC, but Ace himself would also go for the One Piece, even with Whitebeard out of the picture. He HAD to go.
That is why Ace is shown extremely rarely. I bet my ass that Oda never really thought of Ace becoming this "huge thing" in his story. And when he realised it had, he pulled Sabo out of his ass at the eleventh hour (you can't make me believe he wasn't an asspull - and a friend, who's far more into One Piece than I am, because I'm a casual person watching the anime sometimes to catch up, actually told me Oda had directly or indirectly confirmed that he pulled Sabo out of his ass after Ace died).
A lot of characters that have died like this are those that were received by the audience far too well, yet weren't technically that important. Sure, you choose characters you can safely loose in the story, but why would I care that much? I, as a writer, know I'm going to get rid of him, so why would I grow attached? And why would I show a character to my audience and make them love the character, when I know I'm going to kill them? It's not really making anyone happy and the only thing you need to know is how important they were to the MC, which is simple to achieve with a bit of Show and a bit of Tell.
In general, I just don't get it.
If you have seen things like this in stories, I guarantee you, it's that the authors didn't actually think that highly of the character to begin with or, in a live action movie or show, it's that the actor quit on the project or had to be ejected for one reason or another, so they had to make the decision.