It's the small things that spark old memories
The world of Demon Slayer: Kimetsu no Yaiba is one that’s filled with a constant tension. There is the everyday of the Taishou era, a time of relative peace, but there are monsters lurking in the shadows. Demons with supernatural abilities that kill and consume humans roam the land, and following a demon attack that claims his family and infects his sister, Tanjiro joins the one organization that directly opposes the oni. While Tanjiro no doubt has innate skills as a swordsman, one of his strongest traits isn’t his fighting ability, but rather his compassion. It’s not unusual to see shonen heroes have a streak of compassion; in fact, their abilities to understand the struggles of the everyday people who don’t have a voice is common enough. To fight for your friends is to fight for the people you care for and are invested in. To be a champion of the people or of a downtrodden society is to have a high moral compass, even for those you don’t know. The ability to wholeheartedly sympathize with your enemies though, that’s a much rarer thing.
To most of the Demon Slayers, the demons are monsters and remain monsters until they die. They have to be exterminated for the greater good. If someone had recently been changed into the demon, the least they can do is kill them quickly, for mercy killing is ultimately the best they can do. Demons are the enemy, and it’s much easier to think of an enemy as something to be wholeheartedly destroyed. There are no exceptions to the rule and in fact, it’s much easier to be uncompromising in a do-or-die situation. This is a situation where dealing with tragedy is commonplace, and it’s very likely that they haven’t seen any exceptions to the rule to have to think around them. Enemies are enemies, and they have to be killed before they kill more innocent lives.
There is no denying that the oni are mass murderers. That they are almost always willing to view human life as expendable and relish in their newfound power is not something that the series denies. As part of the Demon Slayer Corps, Tanjiro knows that the demons are a threat that needs to be stopped. After all, they did destroy his family, consistently try to harm him, and are overall a menace that feeds on humanity. They are monsters, and have to be cut off at the source, there is no arguing this. However, there are exceptions to the rule, Nezuko being one of them. Even then, he’s aware that she is an exception, and that most demons he encounters are not going to end up rediscovering their humanity midway through. Tanjiro is willing to fight his enemies, but he’s also not one to dehumanize them. He’s aware that demons used to be humans once, and that makes him feel pity instead.
During a lot of demons’ dying moments, they begin to regain portions of their humanity, as they remember what drove them to the edge in the first place. Being abandoned, being unloved, treated as worthless and taken for granted; all negative emotions that ended consuming them and forcing them to the edge. They all have tragedy behind them, and we see what that is as they fade away. That is, we the audience see it—but none of that is communicated to Tanjiro. There are no speeches explaining their backstory, so Tanjiro remains none the wiser, and yet he is able to remind them of something they lost because of his inherent kindness. He is respectful to his enemies when he has no reason whatsoever to be. It’s much easier to return cruelty with cruelty than maintain a level of sympathy for those after your life, especially when you belong to an organization set on wiping out said monsters.
It’s also very clear that this is not a case of naivete. Tanjiro knows the demons are dangerous, and he knows they have to be stopped. He is not the type of character that blindly believes that everyone can be redeemed. He is committed to his cause. Still, doing what you think has to be done and still holding respect and pity for your enemy are not mutually exclusive. Tanjiro manages to do both because he’s inherently polite and kind, something that the demons come to value, even in death.