Can the passive agent be gapped in a relative clause? I mean, can the head of a relative clause be the passive agent (the word that would be marked by に)?
Yes, as long as the subject (patient) is animate.
私が叱られた先生 the teacher I was scolded by
私が財布を盗まれた泥棒 the thief I had my wallet stolen by
私が降られた雨 the rain I got caught in (indirect passive)
Note that, however, the core meaning of the Japanese passive is telling the subject's status being affected by others' action. Thus if you don't have intention to focus on the passive patient (like simply changing the subject), you should keep using the active voice.
Passive with inanimate subject is a marginal usage in Japanese and doesn't have this perk. Usually they don't even mark the agent with に.