Yes, we did have terrorist attacks done against us. That doesn’t mean that every person we locked up as a terrorist was one.
I’m sure some mistakes were made because no system will ever be perfect, but socialist states are fundamentally different from a capitalist, imperialist, globally hegemonic state. Without evidence, there’s no reason to assume that China’s handling of it was analogous to ours.