Considering that, prior to BTAS, most versions of the Riddler (including the comic books) were modeled on Frank Gorshin's cackling madman, I don't think it's surprising how the character was portrayed. The producers obviously wanted that kind of characterization, which is why they approached the two actors they did.
Furthermore, from what I understand, Carrey is/was a lifelong comic book fan and has a pretty good understanding of what makes Batman tick. I remember when he was doing interviews for "Batman Forever", there was one he did with Val Kilmer and the rest of the cast in Rolling Stone.
One of the questions was "who is the great love of Batman's life." And Carrey answered "his dead parents."
He was the only one who got that.
I always thought it was a shame that Carrey hadn't been the Joker originally.