For maybe the first time, I'm more interested in a real-world answer. In-universe, all that can really be said is that those "godlike" beings do exist, and Kirk and company crossed paths with them quite often.
Out of universe, was this a favorite "angle" of Gene Roddenberry and the other writers? Godlike beings in TOS seem to appear every other episode (Apollo, Melkotians, Trelane, Metrons, Organians, Guardian of Forever, "Shore Leave" aliens, Gary Mitchell, Thasians and Charlie Evans, Excalbians, Companion, Redjac, etc., etc.).