I have been a doctor for a pretty long time, and I have a few points I would like to make.
First, I have never asked those questions, nor do I ever intend to. However, in my specialty, those questions would be even more irrelevant than they are to primary care doctors.
Second, the rational for these questions is in the name of safety. However, there are a whole variety of issues that are on the safety agenda for groups like the American Academy of Pediatrics, including things like swimming pools, despite what people here say. The AAP is a liberal group, there is no doubt of that. They certainly have an anti-gun agenda. But they do not limit their discussion to guns. To say that would be a misrepresentation. Here is a page from their safety website, and guns are not mentioned until about half way down:
http://www.aap.org/healthtopics/safety.cfm
They talk about car seats, water safety, bicycles, lawnmowers, shopping carts, poison, etc. So to say they only preach about gun safety is not correct. Individual practitioners may or may not cover all these issues however.
Third, the AMA and AAP are both very liberal organizations. I resigned my AMA membership many years ago when the president of AMA proclaimed guns to be a public health menace in a speech. They certainly have an agenda
Fourth, since the AMA and AAP are involved in establishing practice standards, asking these questions is therefore legitimized. Some here have claimed these questions are irrelevant or a boundary violation. This is not true. They are legitimate questions because the AMA and AAP say they are. If you sue your doctor for asking this, he will be able to get a team of experts from the AMA to testify that he was correct in asking the questions.
Finally, the best way to deal with these questions is to not answer them, and let the doctor know you will go elsewhere for care. Medical practices are very competetive, and they will quickly learn not to tick off potential patients by asking dumb questions. But they have to know why you are leaving the practice.