(Edit: just noticed where the link in TARS's answer points, but I think the point still bears fleshing out)
Another thing to consider is that this behaviour is actually explicitly encouraged by stackexchange.
The stated purpose of the badge system is as follows:
The badge system exists for two reasons:
- to teach new users how Stack Exchange works
- to encourage activities that are positive to the community
And there are in fact a trio (gold, silver and bronze) of badges specifically awarded for this:
Edit and answer 1 question (both actions within 12 hours, answer score > 0)
Edit and answer 50 questions (both actions within 12 hours, answer score > 0)
Edit and answer 500 questions (both actions within 12 hours, answer score > 0)
Now obviously there is an important stipulation in there "answer score > 0". You will not get badges if you don't make a positive contribution and I would anticipate that if you substantially edited a question to make it fit your answer, that edit would be rolled back by the original question author if no one else and then your answer would look bad and you will not get a positive score. But the general case of editing to clean up a question (let's say "refining" it) and then answering it is absolutely encouraged by the system.
If you see the kind of bad behaviour you describe in the question, I would flag it for moderator attention, giving a specific reason explaining what's happened.