How much freedom do mathematics ph.d. students usually have in choosing a topic for their thesis in the U.S?
There's a good deal of variation.  Sometimes students are assigned a very specific problem ("try to prove this conjecture"), sometimes given a slightly less concrete direction in a narrow range of a field, and some students do pick topics basically on their own.

Some of the variation is based on the individual professor, and some on the student - many, maybe most advisors are willing to give a fair amount of leeway to an exceptionally strong student, and will push more structure on a student who seems slightly weaker (weaker being quite relative).  (For example, I did my thesis in proof theory on a series of problems suggested by my advisor directly extending some of his previous work; my academic twin did a much more independent thesis in model theory on a topic my advisor had never directly worked in.)

So the answer is that you definitely can't count on a set theorist, or especially a non-logician, being willing to supervise a thesis in type theory unless you've communicated about that in advance, but it is sometimes done.  Also, people do occasionally have informal advisors, or even official advisors or co-advisors at other institutions; the logic community is small, so it is conceivable that if you get into a school with a good logic program and are really interested in a different area of logic you could nonetheless be at least partially supervised by someone at a different institution.  But, again, it's risky to count on this happening.