We've all had this experience. You go to someone who you know has the answer to a question, ask that person the question and they answer with the typical response: "why?" You explain why you need to know, and they attempt to solve your problem.

It takes time, arm twisting and patience to steer the conversation back to the original question and just get that darn answer.

Why do programmers constantly do this, and why does the behavior get worse the more senior the programmer becomes?

How can you ask a programmer a question in a way most efficient in extracting the answer to the original question?


Why do developers ask "why" when someone asks them how to implement a solution?

Because it requires more knowledge to evaluate whether a solution is appropriate than it does to actually implement the solution.
It's very difficult to believe someone when they say, "I don't know how to do this, but I know for sure it's what I need to do."  Programmers constantly insist on probing deeper because people constantly insist on asking the wrong questions.  Yes, sometimes it eventually comes back around to your original question, but not always.
As an analogy, imagine if someone walked up to a mechanic and asked him how to replace a car battery.  Usually if you're qualified to diagnose a defective battery, you're qualified to change one, so the mechanic will ask how you know it needs replacing.
He knows if he doesn't do this, and it turns out you don't need a battery, then you'll keep coming back asking more and more questions until eventually you figure out that you have to turn the lights off when the engine's not running.  By asking you up front, it feels like he's wasting your time, but really he knows from experience that he's potentially saving both of you a lot more time.
So, if you want to avoid the line of questioning, you need to convince him up front that you know what you're talking about.
