Why would a university restrict publication of work due to plagiarism fears if TurnItIn was used?

Those plagiarism checkers can only detect certain kinds of plagiarism. They will detect for example if text parts are the same. They won't detect missing references or plagiarized ideas.

So if you host your assignment there then others can be "inspired" by that, and if they rewrite everything in their own words and change the code in certain ways but don't cite your GitHub project then it would be a plagiat. But Turnitin might not recognize it as such. Especially since I guess you would need to set the detection level quite low, because for such assignments there will always be a certain overlap in the results if everyone solves the same problem.