Actors have lots of superstitions like this.
Don’t say “Macbeth” in a theater unless it’s actually part of the dialogue in the play. If you break the rule, you’re supposed to turn around three times, spit over your shoulder, curse, and/or some combination of these.
Don’t whistle backstage. Supposedly, this is based in history, whereby the ropes and pulleys and stuff used to manipulate scenery and curtains were operated by sailors, who brought their whistle-based communications from ships when they began working in the theater, so an inappropriate whistle could get something heavy dropped on somebody’s head. I don’t know if I buy this, but lots of theatrical terminology has shipboard roots; all those ropes and things are called “rigging,” and the stage is sometimes called the “deck,” for example.
Don’t wish somebody good luck before a performance. Hence the “anti-” incantation, “Break a leg.”
There’s lots more, ranging from serious to silly. I bet a quick Google on “theatrical superstition” would be revealing.
Regarding the rationale behind the “Macbeth” thing, the common story is that the witches’ incantations in the play (“double, double, toil and trouble,” etc.) were lifted from some “authentic” source of Shakespeare’s day. The play dates from the very early 1600’s, which is when James I succeeded Elizabeth on the throne. As James was something of an amateur witchcraft scholar (he even wrote a book on the subject, IIRC), Shakespeare, being the canny promoter he was, took advantage of the interest and stuck a bunch of related material into his newest play. According to the theory, because these are “legitimate” spells from some book Shakespeare found, they’ve still got a lot of “magick” associated with them, which has carried over to the play, and therefore casual invocation of the name of the play can attract the attention of bad spirits, yada yada yada. I think it’s a load of horse hocky, of course, but it’s still kind of a fun story.
Oh, and for what it’s worth, the actor who gets hammered by Homer’s indiscretion in the Simpsons episode will be Ian McKellen. Yes, he’ll be doing his own voice, too.