Yes, prepositions can definitely take content clauses as complements. HUDDLESTON & PULLUM'S A Student's Introduction to
English Grammar (pp. 175-176) confirms:
Declarative content clauses mostly function as complement of a verb,
noun, adjective, or preposition.
- (1) You can go provided [that you are careful].
The difficulty is that not all prepositions can accept a complement introduced by that. The same grammar book explains:
That is inadmissible in a clause that is complement to a preposition like before:
- *I left before that he arrived.
Most prepositions exclude that; there are only a very few (such as notwithstanding,
in order, and provided), which allow it. In (1) the content clause is complement of a preposition. As noted
above, most prepositions disallow "that", but provided (historically derived from
the past participle of a verb) is one of the few that allow it.
Neither of nor to allow for that clauses as their complements. I have tried to find proof for this affirmation, but unfortunately CAGEL does not include of or to in its list of prepositions governing non-expandable content clauses (which exclude that) - see p. 971. The list of those which can take expandable content clauses is more exhaustive and can be of use to understand more accurately how content clauses function as prepositional complements:
but, in, save, considering, notwithstanding
seeing, except, now, so, given,
provided
supposing, granted, providing
As a conclusion, your two examples are not grammatical. You can however save them, by adding the fact:
He did it by virtue of the fact that he was annoyed.
(intricate way of saying He did it because he was annoyed)
and
She eventually got used to the fact that her life had changed.
As @Araucaria - Not here any more. suggested in a comment, we could alternatively use a gerund-participial clause:
He did it by virtue of his being annoyed
and
She eventually got used to her life having changed.