Not really, it's just random chance mostly, at least during the Shuttle program. The Apollo program was too short to draw firm conclusions from.
People often believe that NASA had bad luck when they lost Challenger and Columbia, the truth is the opposite, they came extremely close to losing a lot more crews. On the very first flight, STS-1, there was a serious problem with the body flap on the orbiter caused by an overpressure wave from the SRBs, John Young, the commander of the flight, said that if he had known of the problem during takeoff he would have bailed out during launch. Later flights had other, equally serious problems. STS-8 came very close to suffering the same fate as Challenger. STS-9 could have easily been lost if the computer crashes that occurred in flight happened during re-entry or to the fire and explosion of 2 out of 3 of its auxiliary power units, which occurred just after touchdown, fortunately. STS-27 suffered sever TPS damage and could easily have been lost just as Columbia was.
For many of these issues NASA worked on fixing them but never acknowledged the full extent of the risk and mostly just pretended that everything was OK up until something bad happened. If the fires on STS-9 never occurred an APU disaster could have resulted in loss of a crew during a flight. Even though TPS damage from foam/ice strikes happened on many flights NASA was never able to tackle the problem and merely got away with being lucky, right up until the loss of Columbia on STS-107.
People often believe that NASA had bad luck when they lost Challenger and Columbia, the truth is the opposite, they came extremely close to losing a lot more crews. On the very first flight, STS-1, there was a serious problem with the body flap on the orbiter caused by an overpressure wave from the SRBs, John Young, the commander of the flight, said that if he had known of the problem during takeoff he would have bailed out during launch. Later flights had other, equally serious problems. STS-8 came very close to suffering the same fate as Challenger. STS-9 could have easily been lost if the computer crashes that occurred in flight happened during re-entry or to the fire and explosion of 2 out of 3 of its auxiliary power units, which occurred just after touchdown, fortunately. STS-27 suffered sever TPS damage and could easily have been lost just as Columbia was.
For many of these issues NASA worked on fixing them but never acknowledged the full extent of the risk and mostly just pretended that everything was OK up until something bad happened. If the fires on STS-9 never occurred an APU disaster could have resulted in loss of a crew during a flight. Even though TPS damage from foam/ice strikes happened on many flights NASA was never able to tackle the problem and merely got away with being lucky, right up until the loss of Columbia on STS-107.