Could I, in theory, find a long-lost cousin through DNA testing without their consent?
Yes, very easily, and many people have. The ethics are genuinely complicated.
When you upload your DNA to one of the major ancestry services that offers relative matching, the algorithm automatically searches the entire database for people who share significant DNA with you. If a long-lost cousin has tested with the same company, you will see them as a match - usually with a relationship estimate and the option to send them a message.
This is exactly how thousands of adoption reunions, donor-conceived family discoveries, and surprise siblings have happened. It is also how many family secrets have been involuntarily uncovered, sometimes painfully.
The cousin doesn't have to consent to be found. Their presence in the database is consent to be matched with relatives - that is built into the service. What they can choose is whether to respond to your message and whether to share their family information.
The ethics question that comes up: is it appropriate to reach out to someone who may not know they have a long-lost cousin, when the discovery might disrupt their understanding of their family? Different people answer this differently. Some communities of genealogy users have developed norms - wait a few days, send a brief and gentle first message, don't assume the other person wants the same level of contact you do, accept silence as an answer.
If you are considering reaching out to someone, write the message you would want to receive in their position. That tends to be the right one.