I know my grandmother and my great grandmother and my other great grandmother and my great grandfather and my 2nd great grandmother on my mother's line are all not the child of their supposed father for their whole life but their mother is their mother.
While not impossible, this seems highly unlikely to me, and I agree with Rosinish's advice.
Do not rely on other people's trees: they are often inaccurate. I'm going to give you a bizarre example from my own DNA and Ancestry ThruLines results.
My great-grandfather was illegitimate. On his delayed record of birth, he named his stepfather (whose surname he used) as his biological father, and his cousin attested to this being true. I know, through diligent research, including speaking to people who knew my great-grandfather and both his family and his stepfather's family, that this was untrue.
But other people do not necessarily know that (and they might not care because they're not related to us), and they have my great-grandfather's stepfather listed as his biological father in their online trees. That's fine; I don't care -- but here's where the confusion comes about.
I have a distant DNA match with a guy on Ancestry. This guy is a descendant of the brother of my great-grandfather's stepfather (so he's a descendant of my great-grandfather's step-uncle). We are not related through that line. However, this guy has my great-grandfather in his tree (undoubtedly copy-pasted from other trees) and has named the step-father as the father.
Ancestry doesn't know this is an error. Its ThruLines system picked up on the "fact" that my great-grandfather's supposed father was the brother of my DNA match's ancestor and gave me an alert that showed how we were supposedly related.
I know, through my extensive research, that this is wrong, and that I must be related to that guy through another ancestor, even though I couldn't find a likely match in his tree (and I might never be able to figure it out). My father's family was from a small area and I'm related to a lot of people whose ancestors also lived in that small area for 100-150 years.
The farther back you go in time, the more likely it is that people have made errors in their trees, because there are fewer records available, and people unaware of what that means will assume that the one baptismal/marriage/death record still extant for a Joe Blow in the right general area at the right approximate time must be for
their Joe Blow. I've seen this error in a lot of trees that show the wrong ancestors for some of my family lines.
Good luck in your search!