For your first pair, number 1 is correct. I think it helps to draw sort of a number line, where "now" corresponds to "zero." In this case, everything that's going on in the sentence is to the left of "now." That's why you need the past tense "when I came here."
Now let's look at your second pair.
I was thinking about calling her when you came.
This is a little unnatural. Here's something more natural:
My brother walked into the kitchen, and asked, "Wasn't Emily coming over for dinner today?" I responded, "I thought so too. I'm getting really hungry. I was just thinking about calling her. Do you think I should?"
What was a little weird about your Sentence #1 was that I don't think one would explicitly say "when you came," since it would be obvious that the second person just walked in (at least, as I'm imagining it).
I had been thinking about calling her when you came.
I don't really have a way of fixing this, or creating a scenario where this sentence would sound natural to me. I think the problem is that the past perfect tense would make sense if the thought process being described had ceased at some point. For example:
I had been planning to make lasagna for dinner yesterday, but then the weather turned warm, and I had a salad. But I've still got all the ingredients for the lasagna sitting in the fridge. If you're not in a hurry, I could make that tonight.
Do you see, that the planning occurred in the past, and then it stopped -- when I decided to have a salad.