Genetic testing isn’t the exclusive realm of 23andme, you can get it done through a medical provider as well who doesn’t have such privacy-violating terms.
I don't tell anyone now to use 23andMe specifically, but the warnings and risks being discussed here apply to existing customers, to people who have already done it, and I am just speaking as one of those people.
But certain general ancestral data can be deduced from variations in your DNA that are observed in some known current/historical population. I.e, I share much in common with people sampled from Scotland -> I must be Scottish.
It's either matching to specific people in the service's reference group who have declared that they are Scottish, or it's trying to guess based on the mix of ancestral populations 2000+ years ago ("western hunter gatherer", "early Neolithic farmer" etc.)