Actually posts are worshipped - Manu, Indra, Saptarisis, Vedvyas, Ganesh or Ganapati or Mahaganapati, Prajapati are merely posts or titles (who holds the title can be found in Puranas. Few of them are given here and here).
Ganesh (Head of Ganas, also known as Ganapati or Mahaganapati) is the prominent post/title since beginning or Aadi kaal (hence considered as one of the Aadi Devas) and must be worshiped before any other god.
How Ganesha became 'the first deity to get worshipped in any ritual'?
As per Shiva Purana, Lord Ganesha became (got the title) Ganapati/Vighneshwar soon after his head was severed by Lord Shiva as demanded by Goddess Parvati.
As per Varaha Purana,
Lord Brahma appeared and requested Lord Shiva by saying-
'You should make this divine child, who has manifested from your mouth, the lord of all these Vinayakas. Thus lord Shiva made Ganesh the lord of all the Vinayakas and blessed him- You will be the first deity to get worshipped in any ritual.'
As stories are from different different Kalpas, so there are many stories related to Lord Ganesha's birth and how he became 'the first deity to get worshipped in any ritual'. But above two are most famous.
Goddess Lakshmi emerged from Samudra Manthan (Ocean-Churning) but if someone conclude from this that there was no Goddess Lakshmi before that then it's not right. Because earlier than this Goddess Lakshmi was daughter of Khyati and Bhrigu. After Indra showed disrespect to her (or sage Durvasa in some stories), she made her abode in the abysmal depth of the sea and later emerged during Samudra Manthan.
Maitreya says - "O sage! It is heard that Lakshmi was produced from Ksheersagar during the churning of the sea but you say that Lakshmi was the daughter of Bhrigu and Khyati. How is it possible?"
Parashar says- "O great Brahmin! Lakshmi who never separates from the Lord is Herself eternal like Him. But still, as you have expressed your doubt, I will narrate you the real story." Read the full story from Vishnu Puran here and here
Similarly, Lord Ganesh is an avatar/incarnation of Mahaganapati. Few popular incarnations of Mahaganapati:
MahotkataVinayak- He was born in Kruta Yuga as son of Kashyap and Aditi. He killed the demons named as Devantak and Narantak.
Ganesh- He was born in Dvaapaara Yuga as the son of Parvati.
Dhumraketu- In Kali Yuga, he will be born as Dhumraketu or Dhumravarna and will destroy the Mlecchas, the sinners.
Lord Ganapti is Aadi Dev, he existed even before his incarnation as son of Lord Shiv and Goddess Parvati. He is there since times immemorial and hence was worshiped by Lord Shiv and Goddess Parvati at the time of their marriage.
This question is related with the below Question(s):
Is Vinayaka an individual or a position like Indra?
Which puranas contain the story of the contest between Ganesha and Kartikeya for vighnadhipatyam?