My first point is: hard drugs aren't generally as good as people imagine.
Heroin makes your skin itch all over and gives you terrible constipation. Cocaine turns you into an intolerable arse of a human, to anyone not high by the same amount. Crack is extremely unsatisfying, to the point of burning up all the money you can access. And meth turns people gibberingly delusional, and withdrawal is horrific (heroin has a reputation for bad withdrawal, but handled gradually in a medical setting it can be painless; alcohol withdrawal can literally kill you outright very quickly if done too abruptly). A realistic picture of use and abuse is the first line of effective harm-minimisation.
Image by 'Owen Cyclops' @OwenBroadcast
This comic I think portrays your suggestion, and the cliche of it's defence.
When exposed to addictive drugs, not everyone gets addicted, it is an inconvenient truth that healthy use is possible, though it's a bit of a lottery of what harms you might be susceptible to. 'Problematic usage' is around 15% of heroin and cocaine users and around 5% of alcohol users. It's interesting the different moral framing we have for alcohol, where we accept some involvement of choices for the addict, whereas there is this idea that hard drugs just 'hotwire' people exposed to them. A lot of that picture relates to flawed research on rats, where isolated rats with nothing to do chose drugged water over food, compulsively until they died. The Rat Park experiments revealed the flaws: if the rats have friends, and things to occupy them in their cages like running wheels, then most rats don't choose the drugs, and those that do only choose them occassionally.
The first drug-panic was when quick and cheap 'Ginevre' became available, for around the same price to make per bottle as beer, but more than ten times stronger. The fears were illustrated by Hogarth, as Gin Lane. Substantial government action was taken, to control and tax distilling, and the Temperance movement remained significant really until the end of Prohibition. But the deeper issue, was agricultural changes, and people dislocated from their communities sustained by commoning and crofting, to live in slums with no support networks, to work all the hours in mills and mines, in laundries and every kind of drudgery, where one injury or illness could end your working life.
In philosophy, Nozick framed a related thought-experiment, the Experience Machine. And, some people would genuinely choose his machine if available - and, many choose as close as they can, like the figure in the comic is portrayed, engaged in computer games and mood regulation of various kinds (which is the real subjective psychological purpose), through consuming stimulants and depressants and deliriants, while occupied with the ludic-loops of game worlds (or gambling). If you frame human purposes as purely about maximising personal happiness or pleasure, as us running a maze to get to dopamine and serotonin, that will even makes sense. But I would suggest what actually motivates us, is finding meaning; with pleasure and happiness as just supportive guides on our journey there.
The Rat Park work shows the impacts of nurture, of social networks and stimulation, or lack of. On nature, our biology, there's substantial work showing exposure to oxycontin and analgesics have been predisposing people to compulsive opioid use, eg increased use of fentanyl as an obstetric analgesic and the current opioid epidemic. There seems to be a link between stimulating opioid receptors and long term reductions in sensitivity that predisposes people who then encounter recreational opioids to addiction - I can't locate the research but I read that children born with some opioid epidurals are at substantially higher risk of related addiction as adults (pethedine has been shown not to have a link).
There's also research showing people paid well but with little control over their work, are less happy and live shorter lives, than people working longer and paid less such as self-employed people. See eg Autonomous orientation predicts longevity. This illustrates how often the thing we think we want, like money, is often just a necessary but not sufficient support for what we really want, like autonomy.
Evolutionarily, what organisms persist in an environment just depends on the replication of replicators. Withdrawal into unreal worlds and heavy drug use is probably not correlated with reproductive success, but then again it may work for some, and a culture or community that aligns these may emerge and persist. In the mechanistic picture, Dawkins describes:
"Now they [genes] swarm ... safe inside gigantic lumbering robots"
-in The Selfish Gene
And the phenotype-robots are controlled by our neurotransmitters regulated by genes, whereby if the incentives change we might cease to reproduce before we can evolve to meet the change - like The Giant Jewel Beetle That Mates With Beer Bottles, which was seriously damaged by the similarity of an Australian beer bottle to it's evolved mating queues (they changed the packaging to prevent risking it's extinction).
Biologist Denis Noble has a more optimistic counterpoint:
"Now they [genes] are trapped in huge colonies, locked inside highly
intelligent beings, moulded by the outside world, communicating with
it by complex processes, through which, blindly, as if by magic,
function emerges. They are in you and me; we are the system that
allows their code to be read; and their preservation is totally
dependent on the joy we experience in reproducing ourselves."
-in The Music of Life
If we look at the emergence of intelligence, we find play among all the brightest creatures, the exploration and development of capacities, and a restlessness towards repetition and stasis, that makes boredom painful especially for young organisms.
So I'd bring these points together, to say retreat from reality is absolutely an option, and based on an individualistic picture of meaning and purpose in life it can even be justified. But, it will be a failing strategy for a species, and desire for that escape correlates with trauma, unhealthiness, and unhappiness - and will be boring, it won't fully engage us because relief from boredom is at root about using and developing our capacities.
A confounding factor is that drugs and games don't always mean a user is seeking to escape reality, they can involve exploration play and socialising in healthy ways. Psychaedelics in particular have been linked with inducing the kinds of neuroplasticity children seem to have, helping allow the rewiring of our brains to overcome trauma and unhappiness and compulsive or unhealthy behaviours. Similarly VR and computer games can augment rather than avoid socialising (I'm sceptical about the positives of gambling, but there too somewhat I guess).
I would note the human capacity to cooperate is our 'superpower', and to a large extent the selection process on culture and political systems will inevitably not only select out autocracies as just innefficient, but also pure individualistic selfishness, as failing to contribute to succesful cooperation. My picture of the mechanics of personal meaning arising from and in relation to our communities, here: What are some philosophical works that explore constructing meaning in life from an agnostic or atheist view?