Critical points of polarized endomorphisms of algebraic varieties My main question is the following:

Let $f: \mathbb{CP}^n \to \mathbb{CP}^n$ be a holomorphic endomorphism of degree $d \ge 2$ of $\mathbb{CP}^n$ .
1. Let $X \subset \mathbb{CP}^n$ be an irreducible algebraic set such that $f(X) = X$. Set $g:= f|_X$. Denote by $V \subset X$ the minimum (with respect the inclusion) algebraic set such that
$$g: X \setminus g^{-1}(V) \to X \setminus V$$
is a covering, i.e. $V$ is the ramification locus of $g$. Is $V$ always an algebraic set of codimension one in $X$ ?

Two partial questions, whose answer are equally interested to me as the main question.

2. Do there exist an irreducible algebraic set $X$ such that $f: X \to X$ and an algebraic set $V \subset X$ of codimension at least $2$ in $X$ such that $f: X \setminus f|_X^{-1}(V) \to X \setminus V$ is a covering ?
3. Does there exists an irreducible algebraic set $X \subset \mathbb{CP}^n$ such that $f(X) = X$ and $f: X \to X$ is a local biholomorphism ?

Motivation:
My motivation for this question is the class of post-critically finite endomorphisms of $\mathbb{CP}^n$. More precisely, let $f : \mathbb{CP}^n \to \mathbb{CP}^n$ be a holomorphic endomorphism. The critical value set $V_f$ of $f$ is an algebraic set such that
$$f: \mathbb{CP}^n \setminus f^{-1}(V_f) \to \mathbb{CP}^n \setminus V_f$$
is a covering. The map $f$ is called post-critically finite if $$PC(f):=\bigcup\limits_{j \ge 0} f^{\circ j}(V_f)$$ is an algebraic set of codimension one of $\mathbb{CP}^n$, where $f^{\circ m}:= f \circ \ldots \circ f$ is the $n$-th iterate of $f$. In other words, for every irreducible component $\Gamma$ of $PC(f)$, $f^{\circ k}(\Gamma)= f^{\circ (k+m)}(\Gamma)$ for some $k \ge 0, m\ge 1$, i.e. $f^{\circ k}(\Gamma)$ is invariant by $f^{\circ m}$. I want to give the same notion of being post-critically finite for the restriction $f^{\circ m}$ to $X:=f^{\circ k}(\Gamma)$. Set $g:= f^{\circ m}|_{X}$.
So the first step is to define what is the critical value set $V_g$ of $g$. Naturally, we can choose a set $V_g$ such that
$$g: X \setminus g^{-1}(V_g) \to X \setminus V_g$$
is a covering. Since $g$ is the restriction of $f^{\circ m}$, one candidate can simply be $X \cap V_{f^{\circ m}}$. However, $V_{f^{\circ m}}$ and $X$ have essentially no relation, the intersection can be very wild. For example, when $X \subset V_{f^{\circ m}}$ or when it can have irreducible component of several dimension. I want to get a codimension set in $X$. However, at this point, I wonder whether can indeed find the case of codimension higher than one
2. Do there exist an irreducible algebraic set $X$ such that $f: X \to X$ and an algebraic set $V \subset X$ of codimension at least $2$ in $X$ such that $f: X \setminus f|_X^{-1}(V) \to X \setminus V$ is a covering ?
Another choice of definition is that, the critical value set is the image of the critical set. Precisely, the critical set $C_f$ is the set of points where the derivative of $f$ is not invertible. Then, $V_f = f(C_f)$. The fact that $C_f$ is an algebraic set of codimension one of $\mathbb{CP}^n$ is non trivial. The reason is that, $C_f$ is the locus of vanishing the Jacobian determinant of $f$. Additionally, the Jacobian determinant of an endomorphism of degree $d$ is a polynomial of degree $(n+1)(d-1)$, thanks to the computation of the classical endomorphism $[x_1:\ldots:x_n] \mapsto [x_1^d:\ldots:x_n^d]$ and the fact that holomorphic endomorphisms form an open connected set in the space of meromorphic endomorphisms of $\mathbb{CP}^n$. When $X$ is a smooth, the critical set $C_g$ of $g$ can be defined in the same fashion, i.e. the vanishing of the Jacobian determinant. In the paper DYNAMICS OF POST-CRITICALLY FINITE MAPS IN HIGHER DIMENSION, Mathieu Astorg, 2018, the author showed that $C_g$ is included in the intersection of $X$ and irreducible components of $C_f$ other than $X$. When $X$ is singular, we can still define the derivative map on the Zariski tangent space, and we can still define the critical locus is the set of points where the derivative is not invertible. Can it be empty ? This leads to the third question.
3. Does there exist an irreducible algebraic set $X \subset \mathbb{CP}^n$ such that $f(X) = X$ and $f: X \to X$ is a local biholomorphism ?
It may be an easy question. Any comment, and especially, reference suggestions about holomorphic maps on algebraic/analytic varieties are welcomed.
Edit: Thanks to the example pointed in a comment by Lucas Kaufmann, the class of endomorphisms with an elliptic curve should provides the answer when $n =2$ and the algebraic set is smooth. Therefore, I would particularly interested in a kind of results in higher generality, say, algebraic set of dimension 2, possibly singular, in $\mathbb{CP}^n$ with $n \ge 3$.
 A: An incomplete answer, too long for a comment:
Such questions deal with ``purity of the branch locus''. Let
$f: X \to Y$ be a finite surjective morphism between irreducible (complex) projective varieties, with $Y$ smooth and $X$ normal. A result by (separately) Zariski znd Nagata from 1950s implies that the ramification locus of $f$  is of pure codimension 1 in $Y$ when nonempty (the Wikipedia page on purity links to both papers).
The problem with straightforward application in the situation when $Y=X$ is that interesting  examples (=other than projective spaces of lower dimension) of varieties $X$ admitting a morphism $f: X \to X$ of degree greater than 1 are often not smooth (see e.g. A. Beauville, Endomorphisms of hypersurfaces and other manifolds, International Mathematics Research Notices, 1 (2001), pp. 53-58.) I am not an expert on purity theorems, so I cannot point you to a suitable generalization which would give a negative answer to your Question 2, but this looks promising: Hansen, Johan P.
Higher order singularities of morphisms to projective space.
Proc. Amer. Math. Soc. 97 (1986), no. 2, 226-232 
