I asked this question on SO meta and this seemed to be the general consensus.
If the tag is totally relevant to the question, then IMO it's only fair that your answer to that question count toward the respective tag badge. After all, it's a question you answered about the topic. If you answered twenty questions about iOS, and every one of them had any combination of xcodeobjective-cswiftuitableviewuisplitviewcontroller (and all the other UIKit classes) but none of them had ios, you wouldn't have the iOS bronze badge, and that would be a shame. (You might gain an Xcode tag badge, despite the fact that none of the questions pertain to Xcode specifically.)
Just don't go doing this all the time, mmk? ;) Also, make sure you're not doing this with new tags (once you gain the tag creation privilege that is) or tags that are relatively obscure. If a tag is too obscure it's more likely to be seen as a cheap attempt at a badge than an improvement of a question. (That doesn't mean there is a correlation between the two, but that's just how things are.)
While we're on the topic of editing, and badges, the best time to edit a question you've answered is within 12 hours either before or after answering. If you take the time to improve the content of the post along with the tags, your edit will count toward Explainer/Refiner/Illuminator. I think as long as you focus more on improving the post and less on getting badges, you'll earn them in due time, plus you make the site a better place. Everyone wins.
But of course if the tag is pointless, that is a problem.