It's also how they prevent and punish genuinely bad behavior, which is why you need to look at why a certain thing is illegal, not just whether it is or isn't.
Does the law say "you may not write bad things about the government or good things about gay people and if you do we'll block your site"? Anything blocked under that law is censorship. Does it say "you must have permission from the rightsholder to distribute any copyrighted material and if you don't we'll block your site"? Blocking under that law, whether you agree with it or not, isn't censorship.