Okay so I'm sure it's common knowledge that Mew is the ancestor of all Pokemon while Arceus is the supposed "god". Asking which came first is practically the chicken vs. egg argument. And there's also man-made Pokemon like the Porygon-lineage and Genesect. It raises a lot of controversies. So I'll start a thread about this where people can share their theories. I'll post mine below to get this started.
I believe that Arceus was the first Pokemon to descend into the world. There it created the Creation trio: Dialga, Palkia and Giratina. Those three shaped the Pokemon World as we know it. And then all those unbreedable Pokemon, speaking legendaries that can't breed with Ditto, were somehow created, some by Arceus and some created each other like how Ho-oh created the legendary dogs. And then there was the Mew species. Mew was once a common Pokemon that was significant for its Transform ability, being able to carry the genetics of all Pokemon. Thus, the Mew species started producing the typical Pokemon, those with egg groups that can breed. And looking at Mew's ability to learn any teachable move that's not a signature move for one Pokemon like the elemental Hyper Beams, it's presumable that Mew passed on different abilities to different offsprings. Different Mew knew different abilities so different Pokemon of different types were born, as well as different Egg Groups.
But over time, the Mew species started to dwindle. Some died and disappeared from existence, others were devolving into the Ditto species, a Pokemon that carried the ability of Mew to transform into any Pokemon but lost the ability to perform other abilities that the Mew species had on its own. Thus, Ditto is just a fraction of Mew, just its transform ability. However, Ditto still had the ability to produce any Pokemon that Mew was able to. So if Ditto was placed in a Day Care with any Pokemon that's a descendant of Mew, then it can produce that Pokemon. But there's one small controversy: genderless Pokemon. Most genderless Pokemon (if not all) are either man-made or extraterritorial so they don't share the genetics of normal Pokemon. However, the people who created them were smart enough to be able to create the patterns of genes that normal Pokemon have so the man-made Pokemon are still Pokemon in its own rights, as shown by how they still use the same moves and are of the same type as normal Pokemon. Thus, Ditto can manipulate its own genes to match that of the man-made Pokemon to breed with it. That's how you can breed a genderless Pokemon with Ditto but not of its same species.
And let's not forget Mewtwo. It's a fact that scientists from Cinnabar got hold of Mew's genes and used them to create Mewtwo. So while Mewtwo is not a descendant of Mew and thus it can't breed with Ditto, it was created from a part of Mew through genetic engineering and thus Mewtwo is still connected with Mew.