If the point of all of creation is for the Jewish people to accept and carry out the torah [I realize this is not axiomatic and may be a point of contention - see Shabbat 88a] what is the need for the trillions of galaxies, dark matter, dark energy etc. and all they contain that exists beyond our solar system?
In the Guide of the Perplexed, Chapter XIV, the Rambam comments on "behold the height of the stars, how high they are!" (Job xxii. 12)
that is to say, learn from the height of the heavens how far we are from comprehending God, for there is an enormous distance between ourselves and these corporeal objects, and the latter are greatly distinguished from us by their position, and hidden from us as regards their essence and most of their actions. How much more incompreliensible therefore is their Maker, who is incorporeal!
We also see in Brachos 58b-59a that Hashem can use the Heavens to directly affect the Earth and ultimately Humans. It says there that Hashem destroyed two stars from a cluster called Kima (Job IX. 9) to bring Noah's flood upon the earth, and took two more stars from Ayish (either Aires' tail, or Ursa Major & Minor) to stop the flood. It seems from here, and the rest of daf 58b, that Earth's characteristics and Human existence relies on the precision of the Heavens, and would be wiped out if certain things were placed differently.
In Chapter X in the Guide of the Perplexed, the Rambam agrees with a well-known philosophy of his era, that everything on earth is is influenced by forces which emanate from the spheres/stars.
To show how this philosophy doesn't contridict our beliefs he quotes Chazal and Job:
In like manner our Sages say "There is no single herb below without its corresponding star above, that beats upon it and commands it to grow." Comp." Knowest thou the ordinances of heaven? Canst thou set the dominion thereof in the earth?" (Job xxxviii. 33)
He also explains here that the word mazzal* can literally mean either constellation or star. Which would mean that every being and species has their own personal star or constellation, which directly corresponds to their mazzal. He compares this connection to the natural force of the moon over the tides.
*The chaotic nature of our world, which can be influenced by Hashem in our every day lives, aka "luck".
The grandeur of creation increases the importance of keeping Torah - it is the point of a much greater world.
It also gives us a better understanding of the greatness of Hashem. The entirety of creation is nothing compared to Hashem. So the greater the world, the more we realize how much greater Hashem is, that all of it is as nothing compared to Him.
The question assumes that each and every aspect of creation is painstakingly ordered and controlled by God. In a certain sense this is true as God created and sustains all, but in another sense it is not. Chazal tell us that one name of God is Shad-dai because at the time of creation everything expanded like two chutes until he said "enough" (shad-dai, mi sh'amar l'olam "dai"). Furthermore Rashi brings the midrash in bereshis that the trees rebelled and did not formulate themselves according to the instruction of their creator.
The picture this paints is that Hashem allows the briah to self-organize. This means that if it takes a trillion galaxies to give rise to the statistical impossibility that is life... well then a trillion galaxies you shall have. We find this idea in a microcosmic way in the difficulty Bilaam had in the amount of wasted sperm it takes to produce a tzaddik. Bilaam said "God who is holy and pure, what possible dealings can he have in the messy and wasteful business of reproduction". But that is exactly the point. God creates the system and part of the rules of the system may necessitate tremendous amounts of waste or useless material. But that is part of the nature of the system and without it the one precious unique thing that is the goal of that process could never exist.
So to answer in short all of this stuff exists because it is a to'tzeah of the natural rules of creation, without which man and Am Yisroel could never have existed.
The Mishnah (Uktzin 3:12 - the concluding mishnah of Shas) states that "in the future Hashem will cause each tzaddik to inherit 310 worlds." These are understood to be spiritual realms (R. Shmuel of Lubavitch, Maamar Shabchi Yerushalayim 5627); but since the physical is an outgrowth of the spiritual, it may well be that there is actual physical "real estate" involved, from which they can derive benefit. (Even nowadays the idea is sometimes floated to extract natural resources from the moon, asteroids, etc.)
So those trillions of galaxies, etc., may simply be waiting for their rightful claimants.
The beauty and multifariousness of Creation is an incontrovertible sign of G-d's might. This includes not only the numberless galaxies and the immeasurable lengths of frightening space. It also includes every other fascinating and beautiful feature of existence, from little animals to snow crystals to colors. It includes evil: a crushing sign of G-d's might (nisht gedacht). It includes the whole canon of secular knowledge, art, music, and other human achievement. Finally, it includes forbidden pleasures, particularly those that closely border on the permissible. We can avoid them with relative ease if we remember that G-d knows their extraordinary pleasure even better than we do, having made them; that G-d is great for having made them; and that we might serve a G-d so great by avoiding them.
The wonder of Creation motivates us to serve G-d humbly. It reminds us that there are principles "out there" beyond our own ends. It reminds us that life is short, that we only have one chance in this beautiful world, and that we must do what we can to get it right.
The mysteriousness of Creation helps us to have Yiras H', the awe of G-d, which we are commanded to have. The beauty and charm of Creation help us to serve G-d with joy, which we are also commanded to do ("serve the LORD thy God with joyfulness, and with gladness of heart, by reason of the abundance of all things" --Devarim 28:47). Creation is the antecessor and motive of the most important Jewish holiday, Shabbos. Arguably one of the biggest innovations of the Jewish religion is that we spend one-seventh of our lives remembering the Creation.
So in short, the wonder of Creation helps us to do mitzvos. It would be insolent to assume that Creation exists only or mainly for this, although that is the teaching of much Jewish philosophy. But we cannot begin to know why else it might exist, so we start there.
in the book Nature's Destiny (pg.255) Dr. Michael Denton brings views how the inertia of matter is determined primarily by the total mass of the universe and if this amount were fewer or smaller life on earth would be much more problematic. here's a quote:
However if inertia had been much greater, then unless the strength of muscles was much greater, we would have profound difficulty even in starting to move our finger. And once in motion, control of its direction and speed would be next to impossible. It is clear that the inertia of matter must be very close to what it is for an animal of our size to function in an environment similar to the earth's. Extraordinary as it seems, physicists have proposed that the inertial forces experienced by objects on the earth are generated by the total combined gravitational attraction of all matter in the cosmos, including the most distant stars and galaxies. Because most of the matter in the universe far from the earth, this means that the greatest contribution to the inertia of objects on earth is made by the most distant galaxies. As Dennis Sciama comments in his "Unity of the Universe"... a bit more here
Indeed the more we discover about the universe, the more we see how everything is necessary and plays a role as Dr. Denton said in an interview:
As far as where science is going in the future, I think that it's going to be increasingly obvious as the scientific revelation rolls on that you cannot account for life in the universe without proposing that there's some intelligent order behind it. And I think this is going to grow more obvious with each year as biological science advances. Already biological systems are, as currently understood, complex almost beyond conception - think of the millions of neuronal path finding cells navigating through the ever changing biochemical matrix of the developing brain and laying down the circuitry of the nervous system, or the zoo of regulatory micro RNAs regulating gene expression, or the complex, ever-changing 3D topologies of the genome during development.
Or consider the fine-tuning of nature to have living things here in the universe and thriving on a planet like the earth. In this area the criteria are becoming more and more stringent as knowledge advances necessitating an ever-greater degree of fine-tuning of nature's laws toward the end of life. I also see this ongoing revelation as one of the great purposes of science in human history. So if you ask me where science is going in the future I think it's essentially going to be drawn towards some form of intelligent design to account for the world we see around us. And I think that's perhaps the destiny of science, and this was perhaps its destiny from its inception. It's perhaps a somewhat extreme or radical view of the scientific adventure but I think that's what it's about.
see his book "Nature's Destiny" for more details. parenthetically with these words he seems to echo the Zohar's predictions as here regarding the lower wisdom.