What prevents a dictator from issuing mandatory IDs? The resistance of the people. Yes, the government has police, and an army, and fighter jets, etc. But in the past few decades we have seen that insurgencies and popular resistance can succeed anyway -- the US got kicked out of Afghanistan and had a lot of trouble in Iraq, Ukraine is outfighting Russia despite massive disadvantages numerically and technologically, and even in China the government softened the zero-Covid program after mass protests. The people have more power than we think and can resist such things, if they want to.