I know in Japanese each particle has a general meaning: を marks a direct object, が a subject, etc. Even で, with its multiple meanings, was explained to me like a sort of boundary-marker: in 私はペンで書きました, the で marks the (figurative) "boundary" of what's used for writing, like there was a boundary around the pen and I were using what's inside that boundary (in an abstract but similar way to how 公園で歩きます means I'm walking inside the boundary of the park, marked by で).
I'm a bit puzzled about に, though: its general meaning seems to be "movement (real or figurative) towards something/someone", like 公園に行きます; also in cases like 東京にいます o クマに会います I can see the figurate movement: the movement of the meeting, like said in that reply, or the fact that to be in a place I had to go there in the first place, as explained to me elsewhere. I'm not sure if this is a stretch or not, but I kinda can see how those explanations fit in the general meaning stated above.
But when it comes to passive and causative, I'm kinda stumped: in a sentence like 私が友達に本を送りました, I am doing the action towards my friend, marked by に, so the usual に meaning; in a passive sentence like 私が友達に本を送られました, though, the action is done by my friend towards me, so it kinda seems the other way around. As far as I understand in the passive sentence 私 is marked by が because I'm the subject of the れる auxiliary verb, so this is coherent with the general meaning, but I'm trying to understand if there is some general meaning I am missing comprensive of both the (seemingly?) opposite directions of "movement".
For example, if I were to read 私が友達に, from が I would know 私 is the subject, but as for 友達 I'd have to wait for what comes next to know the direction of the action, if from me to them (本を送りました) or the other way around (本を送られました); is this how it works? Or there is some underlying general meaning I'm missing?
I hope I was able to explain this question well enough; it's something I'm struggling from some time, and while I tried on book and searching on the Internet, I never really found an answer to this, beside a general "usually it indicates a movement towards something, here it's a movement from something, which is basically the same thing", which doesn't really sounds convincing me; also here I found some specific cases, but not a general analysis.
Edit:
Like で can be seen as a general "boundary setting" meaning in the sense explained above, I'm not sure if there is a general meaning for に, since it seems to me that in translation can have two meanings: direction towards something/recipient of the action (友達に本を送る) and direction from something/doer of the action (友達に本を送られる).
Take で, which is translated among others as:
where an action takes place: 公園で歩いています
the mean used to do something: ペンで書きます
the language used to express something: 日本語で話します
who does something: 一人で勉強します, or みんなで行こうよ
All of these were explained to me as setting a boundary, like explained above, since the intrinsic meaning of で is (according to that explanation) to set a boundary (where I walk is within what boundary? What I use to write is within what boundary? Etc.).
Assuming this is right and not just a made-up explanation trying to give a non-existant general meaning, I was wondering if there is something like that also for に, since I often saw it explained as "It shows the direction towards which the action/movement is going", but for example in the passive it seems to me to be going the other way around.
Is this double direction perceived also from Japanise natives? Or like で there is a general (etymological?) meaning encompassing both? If a native reads 私が友達に would they be unsure about the direction of the following action? I'm not sure if this helps clarifying.
In a nutshell: に is often explained as an arrow: Aに, the action/movement goes towards A, like A ← 行きます. In the passive this goes (seems to go?) the other way around: 友達に本を送られる, the book is going from my friend to me, so 友達 → 送られる, while in the non-passive sentence the direction is the usual: 友達 ← 送る.
I'm not sure if this sort of double meaning/direction is something due to an awkward adaptation/translation to European grammars and languages, or if it's something inherent to the particle itself.