I can see where "habitual offender" might be worthy of consideration when the *current* crime is serious. A guy with a history of armed robberies (for example) might get more time on a rape conviction than he might have gotten without that history.
But stealing and burning a flag?
I'm no lawyer but I can easily see this sentence overturned in the Federal courts.