This is just something I was wondering: I currently have 19 non-CW answers in real-analysis. Could I just go through my old answers looking for a question which involves real analysis but hasn't been so tagged, and retag it in order to get the bronze badge? (No, I wouldn't do this.)
Yes, that would work; your tag scores are recalculated once every 24 hours and they will be based on the current tags of the question. Those tag scores affect badges; you can even lose a tag badge when a tag is removed from a question you answered.
As you say, you should not add tags in order to obtain badges; like all edits, they should be made to improve the post. Having the right tags makes it easier to find a question, so if a real analysis question is incorrectly tagged as number-theory, it's fine to retag it to real-analysis.