In some ways it might seem smarter to put the brain in the middle of the body... but I don't think things evolve like that. That's more the strategy one would use if there was an intelligent designer doing a blueprint of the finished work to begin with, then figuring out where the "safest place" for the nerve center would be in that finalized predesigned product.
In this case, the brain seems to be closest to the intersection of nerves that inadvertently specialized (sight, sound, taste, etc.) into something useful.
Evolution's funny. I think the optic nerves actually run into the eye and then back out than directly out from it; there's a huge chunk of creatures for which this is true ... but not all. Not exactly the best design, but you're stuck with it if it worked and if upgrades to that area did not offer any better survival odds.