The comments to the question, especially those by Emil Jeřábek and Joel Hamkins make it clear that the proposed inconsistency proof breaks down because the recursive construction carried it in the proposed proof of inconsistency cannot be carried out in NBG.
As pointed out first by Mostowski in his 1950 paper Some impredicative definitions in set theory, when it comes to recursive constructions, the problem with NBG (as opposed to the much stronger system KM of Kelley and Morse) is that, the scheme of induction over the natural numbers is not provable in NBG. I would like to outline Mostowski's reasoning here since it sheds light on why the recursion proposed by Taras Banakh need not succeed in an arbitrary model of NBG.
The main idea is that within NBG we can describe, via a second order definition (i.e., by quantifying over classes of NBG) a subset $I$ of the ambient natural numbers of the NBG model such that NBG can prove that $I$ is closed under predecessors, contains $0$, and is closed under successors, but NBG cannot prove that $I$ coincides with the set $\omega$ of natural numbers (in the sense of NBG).
The basic idea is devilishly simple: let $I$ consist of numbers $k$ such that there is a class $S$ (in the ambient model of NBG) such that $S$ is a $k$-satisfaction class, i.e., $S$ satisfies Tarski's compositional clauses for a satisfaction predicate for the structure $(\mathbf{V},\in)$ (in the sense of the ambient NBG model) for formulae of depth at least $k$; here the depth of a formula $\varphi$ is the length of the longest path in the "parsing tree" of $\varphi$ (also known as the "formation tree" or "syntactic tree" of $\varphi$).
With $I$ defined as above, we can specify a unary formula $\sigma(x)$ in the language of NBG such that, provably in NBG, $\sigma(x)$ satisfies Tarski's compositional clauses for all set-theoretical formula whose depth (as defined above) lies in $I$. In particular, $\sigma(x)$ correctly decides the truth of all set-theoretical sentences in the ambient ZF model of NBG since for each standard natural number $k$, NBG can prove that $k \in I$.
$\sigma(x)$ expresses: $x$ is a set-theoretical formula (with parameters) $\varphi(m_1,...,m_s)$, $\mathrm{depth}(\varphi) \in I$, and there is a class $S$ (in the sense of NBG) such that $\varphi(m_1,...,m_s) \in S$ and $S$ is a $k$-satisfaction predicate for $k=\mathrm{depth}(\varphi)$. Note that, provably in NBG, any two $k$-satisfaction classes agree on the truth-evaluation of formulae of depth at most $k$.
With the above definition of $S$$\sigma$ at our disposal, we can write a formula $\theta$ in the language of NBG that asserts that every class is definable in the sense of $S$$\sigma$ in the following sense:
Theorem. If $(\mathcal{M},\frak{X})$ is a model of NBG (where $\mathcal{M}=(M,E)$ is a model of ZF, and $\frak{X}$ is a subset of the powerset of $M$ that specifies the classes of the model), and $M$ is $\omega$-standard, then $(\mathcal{M},\frak{X}) \models \delta$$(\mathcal{M},\frak{X}) \models \theta$ iff $(\mathcal{M},\frak{X})$ is spartan, i.e., $\frak{X}$ consists of subsets of $M$ that are parametrically definable in $\mathcal{M}$.
N.B. In the above, the $\omega$-standardness hypothesis is only used in the left-to-right direction, in other words, $\theta$ holds in every spartan model of NBG.
Besides the Mostowski paper referenced above, readers interested in the history of this subject might want to also examine John Myhill's 1952 paper The hypothesis that all classes are nameable.