That thing wasn't God, though. Q is much closer to being a god than that creature was; and the existence of species like Q, the Organians, and others in the Trek Universe would make recognizing an actual creator being (if one even existed) pretty difficult, if not impossible. But that thing at the centre of the galaxy was just another non-corporeal alien (of whom Kirk encountered many), probably imprisoned there by its own species since it was obviously psychotic. Since the species is obviously quite powerful, they probably established the barrier themselves to contain it.
I'm no great fan of religion in Star Trek, but if someone is seeking that out I usually suggest Deep Space Nine.