‘Associated with’ is not the same as ‘responsible for’. Getting out of bed on a morning is ‘associated with’ longevity, it is not ‘responsible for’ it. I think the expression is ‘correlation is not causation’.
Your interpretation of that is mistaken I'm afraid.
For such a study, the statistical analysis has to be submitted
in advance, to avoid the issue you highlight.
So the study hypothesised that dosing statins would reduce cardiac events, and then showed that was indeed the case.
It isn't just a random association.
the lay summary:
The present study investigated whether consistently taking statins aids to prevent heart attacks, strokes, or death from heart disease among people who otherwise appear healthy. Although statins are commonly prescribed to lower cholesterol, there has been limited research on their benefits in people without other existing health conditions, and this is the first large-scale study to specifically investigate such a population. More than 150 000 people in Denmark who had no previous heart disease or any major health condition but used statins as a preventive measure were followed. The key findings were the following:
- Individuals who used statins consistently had a significantly lower risk of serious heart disease compared with those who used statins infrequently.
- The benefits from consistent statin use were seen in both men and women and across younger and older age groups.
There are many, many studies showing similar in the medical literature. It's a fact that statins reduce the risk of cardiac events, both for primary (people who've never had an event) and secondary (people who've had at least one event already) prevention.
There is also compelling evidence that statins reduce the overall risk of death: eg
https://pubmed.ncbi.nlm.nih.gov/36233511/
Again, this isn't an argument that you personally should take statins, merely that the facts as to the effect on your medical risk are clear.