Perhaps purpose is the wrong starting point.
Instead, shouldn't we search our minds for the fundamental "things" before the universe formed and see how they interacted to create an ever more complex reality?
I say space is fundamental because I define fundamental as something that is not emergent nor dependent on anything other than itself.
That seems to be space. But it is not time, particles nor energy.
I imagine that there are other fundamental "things" but I haven't deduced them yet. The interaction between fundamentals would produce everything else.
Where did the fundamentals come from? The answer is they "always" existed only always is undefined without time which seems to me to have been emergent.
Finally my conclusion is based on the theory that absolute nothing is an impossibility.
Why? Because the universe could not have come from nothing. That means that absolute nothing is an impossibility.