The Maharal explains that the Torah is the seed of all life. The Torah is the blueprint of the world, and from which everything came forth.
The Maharal explains that just as a fruit bearing tree is not considered as reaching its purpose until it has produced its first fruit, so too with the world; the Jewish people were created last of all the nations.
Just as the tree which stems from a seed is only planted for the sake of its fruit, so too the world created from Torah was only created for its fruit – the Jewish people.
This is what is intended in the verse of Lecha Dodi - סוף מעשה במחשבה תחילה (Last in Creation but First in Thought)