Viruses are likely to get mutations due to the fast reproduction cycle, this can lead to different replication mutations. the rate of mutations induced by the DNA polymerase is 1/100,000, it is low, but due to the fast spread of the viruses, it could induce some changes.
But one of the main characteristics of the Delta variant is its ability to evade the immune system, so I would say that the mutations that led to this variable were the environmental factors, because it adapted to be more contagious and also to be able to spread easily.
But to give the right answer it is necessary to look into the specific mutations this variable has in regard to the ones that come before.