Warning. May contain spoilers!
I was intrigued by this question, so I tried to look into the book to see if I could find some clues or discrepancies. I even constructed a mindmap for some of the tidbits after searching for "ages", "years" and "thousands". If you have a mind to it, you can view it at https://app.mindmup.com/map/_free/2019/02/8924114036df11e9a86a2fae851ec44c -- it will auto-erase in 6 months I believe. But I didn't get much that way. It might, however, be useful to use a more convienient mindmap another time.
Re-reading your question and quotes I think I figured, how it should be and I think you are right in your final paragraph.
So we have Firstborn, who are crew (and there are probably passengers as well) of the "Star of India" starship. These include, among others, Sam, Nirriti, Yan Olvegg and some of the other first-generation people.
Then, we have Yama, who is "3d generation". Which could mean grandson of the Firstborn's first body, and son of Firstborn's child's first body. This would make Yama being very old.
Otherwise, he could be a grandson of firstborn's any body and son of his own's father's (and mother's) any body, which would make his age impossible to determine from the book.
But. Celestial City was not where the crew of the ship landed. It was a construct they developed fully only over a vast timeline and before doing that they still had to battle the inhabitants of the planet, as evidenced by these lines:
He thought upon the days when a handful of them had fought the Rakasha and the Nagas, the Gandharvas and the People-of-the-Sea, the Kataputna demons and the Mothers of the Terrible Glow, the Dakshinis and the Pretas, the Skandas and the Pisakas, and had won, tearing a world loose from chaos and building its first city of men. He had seen that city pass through all the stages through which a city can pass, until now it was inhabited by those who could spin their minds for a moment and transform themselves into gods, taking upon them an Aspect that strengthened their bodies and intensified their wills and extended the power of their desires into Attributes, which fell with a force like magic upon those against whom they turned them.
// Sam in Hellwell, freeing Taraka.
So, we have colonists ridding the world of what they considered dangerous, and then:
The Celestial City did not grow up as the cities of men grow up, about a port or near to good farmland, pasturage, hunting country, trade routes or a region rich in some natural resource that men desired and so settled beside. The Celestial City sprang from a conception in the minds of its first dwellers. Its growth was not slow and haphazard, a building added here, a thoroughfare rerouted there, one structure torn down to make way for another, and all parts coming together into an irregular and unseemly whole. No. Every demand of utility was considered and every inch of magnificence calculated by the first planners and the design-augmentation machines. These plans were coordinated and brought to fruition by an architectural artist without peer. Vishnu, the Preserver, held the entire Celestial City within his mind, until the day he circled Milehigh Spire on the back of the Garuda Bird, stared downward and the City was captured perfect in a drop of perspiration on his brow.
That this happened quite a lot of time after they came to the world, is evidenced by:
"But I recall the springtime of the world as though it were yesterday, those days when we rode together to battle, and those nights when we shook the stars loose from the fresh-painted skies! The world was so new and different then, with a menace lurking within every flower and a bomb behind every sunrise. Together we beat a world, you and I, for nothing really wanted us here and everything disputed our coming. We cut and burnt our way across the land and over the seas, and we fought under the seas and in the skies, until there was nothing left to oppose us. Then cities were built, and kingdoms, and we raised up those whom we chose to rule over them, until they ceased to amuse us and we cast them down again." // Kali, speaking to Sam in the Garden of Silence
All of this evidences that Yama's "3d generation" was not meant to be of the original bodies, it just meant the generational order in the children.
- Firstborn came to the world.
- Fought the dangers.
- Created the cities and kingdoms,
- and then at some point created Celestial city. From earlier quote you might read that it was the first city they created, but it doesn't neccessarily follow. And still it is unspecified time after coming to the world.
- Celestial city [of which Yama is half as old], and which "has gone through all stages a city can".
Which just possibly means that his parents and their grandparents weren't very promiscuous. Perhaps, unlike other gods. But really it only takes for Yama's father/mother to have some condition or mindset, which made producing a child unlikely. Yama's grandfather/grandmother (the Firstborn) could beget as many children, but as long as Yama's parent switched bodies for a long time before producing a single child, Yama was still 3d generation.
Also, this is perhaps, fitting, when describing Deathgod (might want to check Hindu mythology for that).
Now, to contrast this with Tak's "17th incarnation" and him being the son of Sam, this all falls in.
In fact, Tak says as much himself:
You speak as one quite young, however. I doubt that he is even aware that he fathered me. What is paternity to the gods, who inhabit a succession of bodies, begetting scores of offspring by others who also change bodies four or five times a century? I am the son of a body he once inhabited, born of another who also passed through many, and I myself no longer live in the same body I was born into.
The relationship, therefore, is quite intangible, and interesting primarily on levels of speculative metaphysics. What is the true father of a man? The circumstances which brought together the two bodies which begat him? Was it the fact that, for some reason, at one moment in time, these two pleased one another beyond any possible alternatives? If so, why? Was it the simple hunger of the flesh, or was it curiosity, or the will? Or was it something else? Pity? Loneliness? The desire to dominate? What feeling, or what thought was father to the body in which I first came into consciousness? I know that the man who inhabited that particular father-body at that particular instant of time is a complicated and powerful personality. Chromosomes mean nothing to us, not really. If we live, we do not carry these hallmarks down through the ages.
So Tak could easily be 17 incarnations and 2nd generation, and still be much younger than Yama who is 3d generation, incarnation X and half as old as Celestial city. In fact, it puts Celestial city as possibly being even much older (which was my feeling during the book). It makes it perfectly possible to have Yama witnessed "a thousand years of Mara's treachery", which wouldn't even need to mean Yama witnessed it from the day 1 of his own life.