The roots of this joke are very old, and it has been attached to a variety of clowns since its inception.
As noted here:
That's a famous story, sometimes told as a joke, often related as
fact. It's really your archetypal "sad clown" story, and indeed
exactly the same tale has been told of other clowns, most notably the
Swiss clown Grock (Charles Wettach, 1880-1959).
Here is one version that predates Watchmen, told of the comedian Joseph Grimaldi:
It is said of Grimaldi that he felt his work so keenly that as soon as
his performance was over, he retired to a corner and wept profusely.
Here was a man of tender heart and generous impulses.
There is a story
about him which has been handed down by many generations of clowns. It
goes on to say that once Grimaldi became very ill and despondent. He
went to consult a great London specialist. The great man looked him over
and then remarked:
"Go to see Grimaldi, and laugh yourself well."
The clown looked at him sadly and replied:
"I am Grimaldi."
Another version was told of the clown Grock:
A story you may or may not have heard relates how, in the mid 1930s or
thereabouts, a prematurely old-looking man asked his chauffeur to
drive him to the consulting rooms of Charles Prelot, Academician, doyen
of French psychologists and you name it, who'd set up his trading pad
in a small palace behind the Quai d'Orsay. After half-an-hour of the
usual rigmarole, it emerged that the worried patient was very rich,
acutely depressed, and given to bouts with bottles of green stuff that
smelt of aniseed balls. He remained somewhat vague about where his
bread came from.
The face of the great savant lit up. He saw both the problem and the
remedy before you could say two thousand francs.
"What you need," he said, "is a change. Go out and enjoy yourself.
Spend a little money. Start tonight. Buy a ticket to the Olympia.
Laugh with Grock for he is, you must admit, the greatest clown in
France, if not the whole world.
The patient shook his head. "Impossible," he said. How was that?
"Because," said the man sighing deeply, "I am Grock."
An old version can be found in the poem "Reir Llorando" or "Laugh Crying," by Juan de Dios Peza. It begins:
Una vez, ante un médico famoso, llegóse un hombre de mirar sombrío:
«Sufro le dijo, un mal tan espantoso como esta palidez del rostro
Once, before a famous doctor, there arrived a man of somber demeanor. "I suffer, I tell you, an evil as frightening as the pallor of my face."
The doctor of course suggests that he go see the great clown Garrick: "all who see him die of laughter," and "he has an astonishing artistic gift."
And the man replies:
¿Y a mí, me hará reír?
¡Ah!, sí, os lo juro, él sí y nadie más que
él; mas... ¿qué os inquieta?
Así dijo el enfermo no me curo;
soy Garrik!... Cambiadme la receta.
And me, he will make me laugh?
"Ah, yes, I swear to to you, he will, and no one other than he, but...what bothers you?"
The patient said, I will not recover thus: I am Garrick! Change my prescription.
Since that poem can be found here, the joke was already at least 100 years old when Alan Moore used it.
There's even a version that references a nonspecific "clown" from three years before Watchmen was published.
The disturbed man blurted out, "But Doctor, I am the clown!"
Each of us, even the clown, is subject to periods of depression and blues.
This also makes it clear that, even before Watchmen, the context was generally less humorous and more philosophic. So no snare drums.
It is worth noting that the word Pagliacci translates to "clowns," and thus may stand in for a generic clown.
It also is very likely a reference (direct or indirect) to the opera Pagliacci. In particular, the subject matter of Smokey Robinson and the Miracles' "The Tears of a Clown" is quite apropos and might have served as an inspiration:
Just like Pagliacci did
I try to keep my sadness hid
Smiling in the public eye
But in my lonely room I cry
This is mirrored in the original opera. Canio plays the role of Pagliaccio, or "Clown," a clown in a circus. He has discovered his wife is with another man, and is "wracked with grief." In translation:
Perform the play! While I am racked with grief,
not knowing what I say or what I do!
And yet...I must...ah, force myself to do it!
Bah! You are not a man!
You are Pagliaccio!
Put on the costume, the powder and the paint:
the people pay and want to laugh.
And if Harlequin steals your Columbine,
laugh, Pagliaccio, and all will applaud you!
Change all your tears and anguish into clowning:
and into a grimace your sobbing and your pain...
Laugh, Pagliaccio, at your shattered love!
Laugh at the sorrow that has rent your heart!
(Grief-stricken, he goes out through the curtain.)
From this, Pagliaccio (or the similar Pagliacci) has become something of a cultural stand-in for the sad clown, the performer who weeps on the inside while making others laugh. As such, his is an obvious name to associate with the Grimaldi "joke."