Are integers mod n a unique factorization domain?

When $\,n\,$ is composite $\,\Bbb Z/n\,$ is not an integral domain. Factorization theory is much more complicated in non-domains, e.g. $\rm\:x = (3+2x)(2-3x)\in \Bbb Z_6[x].\:$ Basic notions such as associate and irreducible bifurcate into a few inequivalent notions, e.g. see

When are Associates Unit Multiples?
D.D. Anderson, M. Axtell, S.J. Forman, and Joe Stickles.
Rocky Mountain J. Math. Volume 34, Number 3 (2004), 811-828.

Factorization in Commutative Rings with Zero-divisors.
D.D. Anderson, Silvia Valdes-Leon.
Rocky Mountain J. Math. Volume 28, Number 2 (1996), 439-480


You have misinterpreted the question to which you linked. What is asserted there is that all ideals of $\mathbb Z/n$ are principal. But that does not make $\mathbb Z/n$ a PID unless it is an integral domain, and, as Bill Dubuque said, that happens only when $n$ is prime.