The image of an old school scientist wearing a wool suit and smoking while mouth pipetting some deadly chemical is a bit of a meme in the scientific community. Not to mention scientists strapping ampules of radium to their arms to observe the radiation burns or chemists listing “taste” among the properties of newly discovered compounds.
I can't speak for all of science over all of time — that's a big question, and a super interesting one. But in the area of nuclear physics, it is pretty clear that in the early days, you have a new area of science that is dominated by (often young) men that saw themselves as literal pioneers or explorers of a "new frontier." There was a "macho" approach and a deliberate disregard for self-preservation in pursuit of priority and prestige (though they would characterize it as a search for truth, but in the end, it is clear that priority was the more immediately motivating factor). There was also not all that much information about the health impacts (though that was steadily growing) of these kinds of dangerous activities. Interestingly, it is not just biological gender at play here: the few women in this field (famously Marie Curie) sometimes adopted the same ethos, perhaps because that was what they saw was necessary to gain respect by the others who dominated it (and indeed, it did sort of work; the "masculinizing" of female scientists in order to succeed in a masculine environment is well-documented by sociologists and anthropologists of science).
So what changed? For one thing, over time, the hazards became more specifically understood and documented. So uncertainty over the dangers became less of a refuge. For another, in this particular field, it became far more enmeshed with governmental funding and contracts, and those require insurance, and insurers have standards, and so you start to get a "bureaucratizing" and "standardization" of the entire field. If it's just you in your basement, it's fine if you are huffing polonium. But if you work for a US national laboratory which is managed by the University of California — sorry, you're not allowed to handle barely-subcritical masses of plutonium with your bare hands anymore, that is going to get us into trouble (aside from being a bad idea).
It's also the case that culturally, these spaces did, over the course of the 20th century, begin to shift. Los Alamos ceased to be an enclave of brash young smart men in the 1970s or so. As you increase the number of people, and diversity of people, involved in an enterprise, the macho shit doesn't really cut it anymore. Such places also cease to be places of individual "genius" and instead become areas of collective activity, and so you get a lot more collective scrutiny. Macho dudes start being seen as idiots rather than heroes. And, of course, a few high profile accidents by said macho dudes — like the famous Louis Slotin accident — can put an end to exceedingly dangerous practices literally overnight.
Now, the situation of nuclear physics, esp. in the United States, should not be taken as representative of all science in all places and all times. But I do think there are some generalizable things going on here. The novelty of the work, and large areas of uncertainty about the hazards, and the degree of skill required to do such work, and the presence of many self-confident young men, does seem to increase the possibility of corner-cutting in the name of getting quicker results. And the increased "professionalization" of the work — regularizing of practice, standardization of tools and methods, the decreasing need for "genius-pioneers" as the field becomes better understood and integrated into earlier phases of education, the increased variety of people who can enter into the field, and the changing approach to the funding of the science (more state- and bureaucracy-driven) — is all going to work towards creating more standardized safety practices. And one cannot discount that during the 20th century there starts to be widespread "worker safety" laws that begin, because of these bureaucratized settings for science, to be applied to scientific research as well.
There is still, of course, a place for the "macho" scientist idea, and it is interesting to track how these highly-individualized, highly-masculinized, non-self-preserving memes/tropes still exist in both the formal and informal education of future scientists. They play a role that is probably outsized than they actually are in the reality of the history. My account above of the "macho" physicists is really leaving out probably 99% of all actual practitioners and practices during this period, not only because of the selection effect that comes into play when you only focus on the people who had priority and Nobels and things like that, but also because that's how we like to talk about the history of physics to both physicists and laymen. For both, it's the more exciting story than the bulk of the work (who wants to hear about the grad students who dully counted bubble chamber tracks by the thousands?), but for physicists, it is also a way to impress upon them some concept of "ideals of science" (like self-sacrifice, which today doesn't usually mean literal health, but does often mean being paid next-to-nothing in the early phases of the career path). So a secondary question is not, "how did this change?" but "how much did this actually change, if we look at the history of science more broadly, and why do we like to tell stories that focus on probably anomalously dangerous research practices?"
Anyway, this is a great question, and provides a lot of food for thought, and is one of those questions that showcases how gender analysis in science provides much more concrete answers than a lot of people (esp. scientists) give it credit for, because these are very self-consciously "masculine" themes (even when being acted out by women). The above is just a sketch of an answer; one could write entire books on this, and I am sure the answer is going to be different for chemistry (which was the first science to be very deeply connected with industry, which probably brought its own transformations), biology, and so on.
In terms of further reading, the book that has had the most impact on my own thoughts above is Sharon Traweek's Beamtimes and Lifetimes: The World of High Energy Physicists (Harvard University Press, 1988), which is an ethnographic sociology of the high-energy physics community around SLAC in the 1980s, and does a lot of interesting analysis about the ways in which masculinity in particular is embodied in the stories that scientists teach and tell one another about the past and present of science, but also is reflected in many of the institutional infrastructure and practices of science (e.g., at least in the 1980s, it was assumed that your ideal graduate student was male and married with a wife who would be subverting any of her own career goals to that of her husband, which would allow him the space to devote almost every free hour he had to his research).
On changing practices in nuclear physics in the 20th century American context, J. Samuel Walker's Permissible Dose: A History of Radiation Protection in the Twentieth Century (University of California Press, 2000) is a very useful reference, though it is not so much about the changing culture as it is about the changing regulations. I have also found Barton Hacker's The Dragon's Tail: Radiation Safety in the Manhattan Project, 1942-1946 (University of California Press, 1987) very useful, as it essentially tells a story of how one goes from a (somewhat literally) "wild west" attitude towards safety during the atomic bomb project, to the creation of a highly-bureaucratized system for radiation safety as it transitions from a wartime crash program to a regularized peacetime research effort.