It wasn't that Rem was irrational, it was that the plot made her intentionally stupid so that Light could win. Honestly, the conversation should have gone like this:
Light: Hey Rem! L is gonna figure out that Misa is the second Kira, and when he does, he's gonna arrest and/or execute her! You have to kill L to protect Misa!
Rem: Uh ... no I don't. I believe I made it clear that if anything happens to Misa, I will kill you. If this L person harms Misa in any way, I will hold you responsible and end your life. Protect Misa yourself or start writing yourself a will.
Near won because of help from a large number of people, including Mello, Gevanni and L. He's modest enough to admit this, and even says that he couldn't have done it without them. That doesn't make his victory any less than what it was. Victory through teamwork and co-operation is an admirable thing. By contrast, Light's victory over L was purely due to writer fiat making Rem dumber than a bag of drunken monkeys.
Heh, well I suppose we are discussing the end of a serial, just the end of a manga/anime serial.