Excellent question! Looking into etymology is an excellent way to understand the connections across words and phrases within the English language.
"Virtue" comes from the Latin word vir, meaning "man" with connotations of strength and heroism, whence (also Latin) virtūs, meaning "manliness, courage, character, excellence." The English word "virile" also comes from vir, and is the Latinate synonym for the Anglo-Saxon "manly".
(Many English words come in Latinate and Germanic synonym-pairs like that. Other examples are: work/labor, often/frequently, find/locate, learning/education, smart/intelligent, and thousands more. The Germanic synonyms often have a different connotation and slightly different meaning from the Latinate synonyms.)
In later Latin, people also used virtūs to mean supernatural, miraculous, or even military or legal power. English absorbed the word "virtue" from medieval French to mean something like power or strength, especially power with a supernatural character, as well as courage, merit, a distinctive ability, or simply any specific quality at all, such as the power of a plant or chemical substance to produce an effect, especially a medicinal effect. The masculine connotation was lost in English, but the connotations of power and moral excellence have remained.
Today, "a virtue" usually means a desirable ability, a beneficial power, or a morally upright practice; "virtue" means beneficial quality or moral uprightness; and phrases like "in virtue of" still echo the meaning of power or quality. Usually when people say "in virtue of", they usually aren't describing any result of any cause, but a result that is explained by a distinctive or specific quality or power of something.
Here are some typical examples that I found by searching Google Books (slightly edited, trying to avoid books about "virtue"):
To the extent that a country survives in virtue of its having certain institutions, … those institutions are likely reliant on the significant loyalty of some of [their] members. [Source]
In virtue of his legislative power he fixed the rate of interest, and in virtue of his judicial [power] he inflicted the penalty of confiscation. [Source]
The Sthavira or ‘elder’ was merely superior to others in virtue of his age. The Upādhyāya and Āćārya were teachers of different kinds, who received honor in virtue of their knowledge. [Source]
While it's technically possible to say "in virtue of" in regard to anything, the phrase still evokes the word's meaning of a specific power or quality. As you can see in the third example, even the meaning of admirable personal character can still be echoed in "in virtue of".
Probably the most famous use of "virtue" in the sense of a specific power of something is the phrase "dormitive virtue" from Molière's play The Imaginary Invalid, in which a pompous doctor explains opium's power to cause sleep by saying (in Latin) that it has a "dormitive virtue". The phrase "dormitive virtue" has come to mean an empty expression, using more-abstract words to sound as if one is explaining something but really just restating the thing to be explained.