Why doesn't the definition "$p$ is called 'prime' if $p\mid ab\implies p\mid a\,\text{ or }\,p\mid b$" hold up when we square numbers?
Take $\mathbb Z$ and $12$.
$12$ is divided by $4$.
$12=6\cdot2$, but $6$ is not divided by $4$ and $2$ is not divided by $4$, which says that $4$ is not prime.
Let's take a step further from your last line:
$4 \mid 4 \implies 4 \mid 2\cdot2$, but $4 \mid 2 $ does not hold, so $4$ is not a prime. (We have $a = b = 2$, $p=4$)
Going back to your definition:
An element $p$ of a ring $R$ is called "prime" if $a,b\in R$ and $p|ab\rightarrow p|a$ or $p|b$
As was mentioned in the comments, the implied requirement is that this applies for all $a$ and $b$.
You're trying the case of $4$ being prime, so $p=4$. Letting $a=2$ and $b=2$ is a counterexample, which shows that $4$ is not a prime.
The definition really just says that a multiplication can't make new prime factors appear, but instead all prime factors must be present in the composition of (at least one of) the multiplied items.
If it were enough to find just any one pair $a,b$ satisfying $p|a$ and $p|b$ to make $p$ a prime, then we could easily prove that any number is prime. It would be simplest to let $a = b = p$, but that's the squaring you already did. So let's try with e.g. $a = 12$, $b=18$, $p=6$:
$6\mid 216$ and $216 = 12\cdot 18$, so since $6\mid 12$ and $6\mid 18$, then $6$ is prime. This is of course nonsensical.
Going back to your example, with $p=16$.
If I choose $a=12$ and $b=4$, then I have $p | ab$, but neither $p|a$ nor $p|b$. Hence, $p$ is not prime.
The definition requires that you consider any $a, b$ such that $p|ab$, not only those such that $p=ab$.