A fair question!
The basic answer is to be found in Pascal: “God wishes to move the will rather than the mind. Perfect clarity would help the mind and harm the will.”
God has created you and the world you are in so as to give you the perfect environment for becoming perfect — i.e. as much like God as it is possible for a created, finite being. Part of the recipe for that seems to be to give us the desire to understand but put us in a world that both tempts understanding and then resists it.
A world in which intelligence were scattered around according to an understandable plan would be very clear and easy to understand. It would help the mind, but harm the will.
In other words it is better for us to exist in a mysterious, hard-to-fathom universe than a clear universe because it is better for our will.
Existing in a mysterious universe (of which the rareness and out out-of-the-wayness of human intelligence on a cosmic scale is but one symptom of many many) mean we have to be able to decide how to live our lives against a background of mystery. This is a cooler ability than the ability to decide how to live your life against the background of a world that makes perfect sense.
You could say G-d acts to maximize the coolness of our existential situation. (I think this may be a LITTLE like maximizing the profundity of a story of which we are the star, but I’m not sure.)
Hovering behind Sagan’s question is the view that it is sort of wasteful for God to create all those gazillions of galaxies just to create a mysterious universe for us. This is wrong. It’s not wasteful of anything because G-d creates everything from nothing by a simple act of will. It doesn’t take any more effort for God to create 100 billion galaxies than it would take him to create a grain of sand or a fly’s anus. God creates the way a dreamer or a writer creates — in a single stroke. He doesn’t have to personally haul all the atoms to make those galaxies like he’s on a construction site.