Translation:You must get rid of this bad habit.
It's certainly one possible translation but I don't agree that it's a better one, as 'rid yourself' has become a somewhat archaic use in contemporary english. I think the current given translation - "You must get rid of this bad habit" - is a more common way of expressing what the french sentence is saying.
There is no obligation to use the exact same grammatic structures when translating, only an obligation to translate meaning.
I think it's because tu dois is the second person singular of the present tense of devoir which would translate in English as "you shall" or "you have to" or "you must".
"You should" is the more tentative or delicately offered future conditional tense, suggesting that you might or might not rid yourself of the habit, i.e you have an option. The French would then be tu devrais.
It's like "je veux" for "I want", and "je voudrais" meaning "I would want" (if you were so kind as to agree to accommodate my request in the near future....)
Little Jacques: "I want a cake!" But Mummy suggests "It's nicer if you say you'd like a cake, Jimmy dear"!)
Ta = your for feminine words. Ton = your for masculine words (or feminine words that start with a vowel or an h muet).
Te is more complex. When used with a reflexive verb it means yourself. When used as a direct object it means you. When used as an indirect object it usually means to you.
There are several DL lessons about this earlier in the tree.
I agree with other commentators criticisms. You should rid yourself.... Is indeed more formal, but perhaps such an injunction does call for some formality lest it be seen as peremptory, impolite or rude. Context determines whether the active or passive voice should be used to deliver an injunction; IMO the latter is more likely to be effective in changing behaviour than the former.