Lemma 1
Each principal left ideal is generated by an idempotent. Proof: Consider $Ra$ for some $a\in R$. Then $a=axa$, and $xa$ is idempotent. Finally, $Ra=Raxa\subseteq Rxa\subseteq Ra$. Thus $Ra=Rxa$.
Lemma 2
The sum of two principal left ideals is again principal. Proof: Consider $Re+Rf$ where $e,f$ are idempotents for the two principal left ideals found via lemma 1. Since $R(f-fe)$ is principal, it is equal to $Rg$ for some idempotent $g$. Furthermore, $ge=gge\in Rge=R(f-fe)e=0$.
Claim 1: $Re+Rg=R(e+g)$. Both $e=ee$ and $g=gg$ are in the left hand side, so $e+g$ is in the left hand side, proving $\supseteq$. On the other hand, $g=g(e+g)$ and $e=e(e+g)-eg(e+g)$, proving that both $Re$ and $Rg$ and $Re+Rg\subseteq R(e+g)$.
Claim 2: $Re+Rg=Re+Rf$. Recall that we set $Rg=R(f-fe)$. Now $f-fe=ff-fe\in Rf+Re$ proves $Rg\subseteq Re+Rf$, and of course $Re\subseteq Re+Rf$, so we have achieved $Re+Rg\subseteq Re+Rf$. In the other direction, $Rf \subseteq Re+Rg$ since $f = \underbrace{f-fe}_{\in R(f-fe) = Rg} + \underbrace{f}_{\in R}e \in Rg+Re = Re+Rg$, and thus $Re+Rf \subseteq Re+Rg$.
The two claims combine to prove that $Re+Rf$ is principal. By induction we conclude that in fact any finitely generated left ideal is principal.
Lemma 3:
By symmetry, the sum of two principal right ideals is principal, and finitely generated right ideals are principal.
Proof that $R$ has identity
Since $R$ is finite, it is finitely generated as a left $R$-module (because the assumption $x = xyx$ yields $x \in Rx$ for each $x \in R$). There is therefore some idempotent $e$ such that $R=Re$. Then for every $r\in R$, $r=se$ is unchanged by multiplication on the right by $e$. This shows $e$ is a right identity. By Lemma 3 and symmetry, there is a left identity $e'$. But $e'=e'e=e$, so it turns out that $e$ is the identity of $R$.
Finite rings are Dedekind finite
Now that the problem about existence of identity has been solved, the Dedekind finiteness follows as in other posts. If $ab=1$, $b$ creates an injective map of $R$ into itself by left multiplication, but this must also be surjective, etc.