I'm thinking that by Cauchy's theorem, the integral around gamma would equal zero unless there is a singularity inside gamma, so that is where the zero inside comes from. However, I fail to see how it being constant is an application of the maximum modulus principle?

Because, if f(z) = w, then g(z) = f(z) - w is identically zero around gamma?