Is there any connection between these two facts? Should we question the validity of the theory of relativity because Einstein engaged in behavior that would seem morally questionable to many people?
No, of course not.
Universal scientific truths have no connection with individual, or even societal, moral norms. The cosmos doesn't care what we do with our bodies and minds. Laws of nature aren't dependent on human thou shalt's and thou shalt not's.
So why do religions put so much emphasis on adhering to moral codes and commandments? (Which markedly differ from each other, but every religion has them.)
Imagine that Jesus had a "significant other," which, of course, could have been the case -- given that so much of Jesus' life is shrouded in myth and mystery. He could have been gay, but I'll assume his bed partner was a woman.
Imagine further that a previously unknown gospel is discovered in a newly unearthed middle eastern cave. Scholars affirm it is as historically valid as Matthew, Mark, Luke, and John. Roughly translated, the gospel contains this passage:
While Jesus loved his wife, he also enjoyed hot sex with six girlfriends.
Would this throw Christian theology into a tailspin? Would the Christian faithful question whether Jesus truly was the son of God who died on the cross to atone for mankind's sins if, prior to his atonement, he'd happily fucked six women along with his wife?
(When climaxing, I picture Jesus throwing his head back and screaming "Oh my god! Oh my god!")
The truths Einstein discovered are independent of his personal lifestyle choices. They are part and parcel of a universal reality far removed from human notions of morality.
Yes, some philosophers, such as Derek Parfit, assert that moral reasoning is more objective than is commonly believed. This is a controversial position, though, by no means proven in anywhere near the same sense that the theory of relativity has been.
Yet most believers in the validity of a divine reality continue to associate truth-revealing and morality.
Prophets, mystics, gurus, masters, sages, yogis, popes, preachers, and such generally aren't trusted if their personal lives aren't in accord with a particular moral code esteemed by believers in a certain religion, spiritual teaching, or mystical practice.
I used to belong to an India-based organization which taught that god-realization wasn't possible without being a vegetarian, abstaining from alcohol and illicit drugs, and not having sex outside of marriage.
Having briefly been a Catholic in my childhood years, I sometimes thought about the wine-soaked wafer I was given at holy communion. Most Christians certainly would disagree that alcohol consumption is a barrier to knowing God. And many cultures use psychedelics (such as "magic mushrooms") to commune with divinity.
It now seems to me that the reason morality is so intimately connected with spiritual truths, but not scientific ones, is this: those supposed spiritual truths are lies.
People may subjectively believe in them. However, they have no objective reality. Light and gravity really do behave in accord with the theory of relativity. There is no similar demonstrable evidence to support the assertions of believers in supernatural laws of nature.
Thus religions are left with subjective moral injunctions rather than objective truths. People cling to these commandments for many reasons, some of which may make sense. But only to us humans.
The cosmos rolls on, oblivious to our notions of right and wrong, good and bad. Science understands this; religions don't.