Can I take The Castle without doing the quest?

Solution 1:

I ended up doing the same thing, if you get the castle before Preston offers you the quest, it won't have any impact on the minutemen questline until you get to the point where he offers the 'retake the castle' (I believe you need to complete three or four settlement recruitment quests for him)at this point you get the speech option to say somthing to the effect of "i've already cleared that place out" and you automatically skip to the second stage of that quest, where you need to build enough generators to power the radio antenna at the castle. After that the minutemen quests proceed as usual. It actually saves time doing it the way you have.

Solution 2:

I'd say grab the material you need for a normal radio tower and generator and build it in the castle and wait until you get a settler for the "big" tower.