Yes, hereditary occupations eventually makes for a caste (varṇa) within 7th generation if followed successively generation after generation.
Yājñavalkya (1.96).—‘Caste becomes elevated during the fifth or the seventh generation; similarly after five or seven generations one acquires that caste of which he has followed the occupations.’
And this makes a complete sense, for example (might not take literally), it's obviously improbableimpossible that all of my forefather since creation weresince creation or even current manvantra have been Kṣatriya-s. Of course, I have a record of all my paternal ancestors back to the mighty Jayachandra but I don't have any proof that they all married within the same varṇa? Moreover, what about ancestors prior to the Jayachandra?