Roddenberry apparently got the idea of Q after the main story involving the jellyfish aliens was developed. So the trial plot was probably quickly written and just shoved in there where it could fit.
Roddenberry and Paramount haggled quite a bit over whether the pilot episode would be a standard hour, 90 minutes, two hours, etc. The original story just concerned Farpoint station and the jellyfish aliens. When it was finally agreed that it would be a 2-hour pilot, the Q story was hastily concocted to fill out the extra time. If I'm not mistaken, I think D.C. Fontana came up with the Q parts.
Even still, you can tell that the episode is heavily padded to fill out the two hours. The pacing and the editing are kept deliberately slow so as to run out the clock. It's essentially a one-hour story being told in two hours, and the episode is hurt by that.