- When I was a child, my parents bought me a dog.
- When I was a child, my parents had bought me a dog.
I disagree that 2 is correct. You shouldn't use a perfect tense here. You are talking about the moment in time where your parents made the purchase. This means that, at the time, the purchase was not yet completed.
You would only use a perfect tense if the activity (buying a dog) was already completed.
If your parents bought you a dog when you were 5 years old, it would be correct to say:
When I was 15, I did not misbehave. I loved my parents because they had bought me a dog [when I was 5].
You loved your parents because at the moment in time we are talking about (when you were 15) you were loving your parents. However, the purchase of the dog was already completed by the time you were 15 (since they had bought it when you were 5).
When I was 12, my parents had already bought me a dog.
You are not stating that your parents bought you a dog when you were 12. You are saying that they bought that dog before you were 12, because you are using a perfect tense.
The key here is that you need to consider the use of the perfect tense at the time. You are trying to compare it to the present (the year 2017); not the point in time you are talking about (your childhood).