As noted by Rabbi Natan Slifkin, there does not appear to be much early precedent for such an idea, at least as you're describing:
In my essay "What Can One Do For Someone Who Has Passed Away?" I noted
that classically, one's mitzvos are only a credit to those people who
had a formative influence on you. One's mitzvos cannot help the souls
of other ...