Grandfathering, or legal nonconforming use, generally applies to a use that was lawful when it started and later became disallowed by a change in the rules. A basement unit built without permits was never lawful to begin with in most jurisdictions, so time renting it doesn't convert it. How that works depends on the specific ordinance and on state law, so a local land use attorney is the person who can tell you where this address stands.
Parcel has the split right. There are three separate gates. Whether the unit is legal is a code and zoning question for the city, and current ADU-friendly zoning often means the unit could be permitted going forward, sometimes with retrofits like egress windows, ceiling height, or a fire separation between units. Whether a lender will count the rent toward your qualifying income is a second question, and appraisers are generally instructed to treat a unit that doesn't conform to local zoning carefully, which often means the income doesn't survive underwriting even though the tenant is sitting right there. Whether your insurance carrier will cover a rented unit they weren't told about is the third, and that's the one that bites hardest, because a denied claim shows up after a fire rather than during diligence.
What I'd do before removing contingencies is call the city's permit counter with the address and ask what's on file, then ask what it would take to permit the unit. If the answer is egress plus a sprinkler requirement, that number belongs in your offer price.