Q. When writing a sitcom pilot containing both an A and B story, is it preferable to have the B story somehow connected to the A story (i.e., via theme, plot, location, etc.) or totally unrelated to the A story?
Personally, I think related is more interesting, if you can make it work. You can play one storyline broad and one storyline subtle, and have them reflect on each other. In a drama script, you can counterpoint a dramatic storyline with a comic storyline with the same theme, and shed light on more than one facet of the them.
However, unless you're writing a themed show (such as
Sex and the City or my show
Naked Josh), you don't have to relate the two stories.
That said you do want to weave the stories together so that they're not doing the exact same thing at the same time: an action beat in one story intercuts with a suspense or dramatic beat in the other story, a slow beat with a fast beat. You'd never cut between two car chases, obviously.
Think of your episode as a fabric. You want to weave the stories together so that the whole is more than the sum of its parts. The more the stories shed light on each other, the more valuable the overall fabric is. The more they counterpoint each other, the more colorful the fabric is. Be careful your colors don't clash, and make sure you've woven the stories together or the fabric will fall apart. And that's not good.