As I understand it, you get the relations penalty only if you attack someone to whom you have given a treaty-if you have one of theirs, you ought to be fine. There are those among us who never give out their treaties for precisely this reason.
For what it's worth, I can't remember the last time I was in such a situation, because I'm more concerned about the functional rather than the diplomatic aspects of said treaties.
You are of course correct that treaties do increase diplomatic relations, and no, I'm not aware of the direction mattering. Hence the "almost" preceding the useless
As for how much the treaty will cost, that's another matter entirely, and I don't exactly have numbers for that...