Illegal for health insurance companies. But not so for life insurance, or disability insurance or long-term care.
It's illegal in some US states like California. The California Genetic Information Privacy Act prohibits these companies from disclosing a consumer’s genetic data to any entity that is responsible for administering or making decisions regarding health insurance, life insurance, long-term care insurance, disability insurance.
If they wanted to use that information for underwriting they'd just make getting a genetic test a prereq before underwriting the policy.
And if they wanted easy cash they'd "just" make you pay $500 as a signup fee.
Which is to say: No they wouldn't just do that, it would cut their business too much despite being a way to make more money per client.
But getting it from a company that already has it avoids that downside.