The hadith mentioned in the link ("Laulaka") which alleges that the universe was created because of Prophet Muhammad (ﷺ) is not authentic or in line with the teaching of the Qur'an. Allah (ﷻ) told us why we were created; it was to worship Allah (ﷻ). That is the whole reason anything and anyone was created. Period. Prophet Muhammad (ﷺ) was just someone who was created along with the rest of humanity but excelled above everyone due to his love of Allah (ﷻ), loyalty, commitment, good heart and righteousness.
(Note: Whoever does believe that the hadith is authentic would then by default have to believe that there was another realm in which people 'proved' themselves.. thus why the universe would be created for a particular person. This is why you are in this confusion and asking this question. But the premise is wrong so this line of thinking should not be taken further. This Dunya is the realm of being tested and proving yourself to Allah (ﷻ)).
With the above in mind, acknowledging that Allah (ﷻ) created the Universe as He Willed, we come to the question of what happened before this Dunya? Were we around in any way? - The answer is yes. Allah (ﷻ) told us about it on one instance in the Qur'an, when He extracted all souls of everyone who would be born later in the Dunya and we all equally testified that Allah is God.
And [mention] when your Lord took from the children of Adam - from their loins - their descendants and made them testify of themselves, [saying to them], "Am I not your Lord?" They said, "Yes, we have testified." [This] - lest you should say on the day of Resurrection, "Indeed, we were of this unaware." - Qur'an 7:172.
^ That was the "Day of the Covenant".
As for the question of the "time frame"/timeline on everything that happened, very limited knowledge has been given. So nothing can be said for certain if there is nothing in the texts.