Sun Wukong did not have an absolute sense of good or evil. In his view, whether it was the Demon Clan or the Human Race, if one acted righteously, then they were righteous; if they acted wickedly, then they were wicked. As for the standards of good and evil, he believed it was best to follow one's heart.
The rat demon, in Sun Wukong's opinion, indeed had a way of courting death, but it was not necessarily a must to kill her. One reason was that she needed to assist Jiang Liu'er in completing the Eighty-One Tribulations of the Journey to the West to Seek Scriptures. On the other hand, Sun Wukong also believed she had not yet reached the point where she must be killed.
Of course, if she still thought of eating people and doing evil after being warned, then she was indeed seeking her own death. Even at the risk of not fully facing the Eighty-One Tribulations, Sun Wukong would take action to eliminate her!