In this post, the symbol $\sim$ means asymptotically equivalent.
The relationship between $\pi$ and factorials hinges on Stirling's formula: $$n!\sim \sqrt{2\pi n}\left(\frac{n}{e}\right)^n\implies n!^2\sim 2\pi n\left(\frac{n}{e}\right)^{2n}.$$ In a similar manner, $$(2n)!\sim \sqrt{4\pi n}\left(\frac{2n}{e}\right)^{2n}.$$ Then, by taking the ratio of the two quantities and simplifying one gets $$\frac{(2n)!}{n!^2}\sim \frac{2^{2n}}{\sqrt{\pi n}}.$$ By squaring both sides and further manipulation: $$\pi =\lim_{n\to\infty}\frac{2^{4n}n!^4}{n(2n)!^2}.$$ Also, note that the last limit for $\pi$ above and $$\frac{n!^2}{2n}\left(\frac{e}{n}\right)^{2n}$$ (which can be obtained as a limit for $\pi$ from Stirling's formula dircetly) have a different rate of convergence.
My question is, how can one justify the manipulations (e.g. squaring both sides) when the expressions are not equivalent but only asymptotically equivalent? When I used this I ran into problems: $$\ln n!\sim n\ln n-n\, \text{(true)},$$ $$n!\sim e^{n\ln n-n}\, \text{(false)}.$$
You are right that not all operations with asymptotically equivalent expressions are correct. For example, $f\sim g$ doesn't necessarily imply $e^f\sim e^g$. However, $f\sim g$ implies $f^k\sim g^k$ where $k$ is an integer. This follows directly from properties of limits: $$\lim_{x\to a}\frac{f(x)^k}{g(x)^k}=\left(\lim_{x\to a}\frac{f(x)}{g(x)}\right)^k=1^k=1 $$ (This can be generalized to $k\in\mathbb{R}$ provided $f(x)^k$ is defined). Since the only thing we're doing here is squaring, i.e. $k=2$, your manipulations are justified.