I think it had more to do with context SPOILERS
If it hadn't literally been the last thing you see in the film, I think people wouldn't have freaked out. It also underlines the inconsistent tone. Matt touched on the fact that Nicholson is distractingly cartoony and I basically agree. He's still fun to watch but ultimately distracting and the character just seems like he's from a different movie. So in a sense, the rat is a confirmation of the audience's suspicion (brought on by Nicholson's performance) that they are, in fact, watching a live action cartoon rather than simply an Irish/Boston version of "Goodfellas".