There are consistent first-order theories that prove their own inconsistency. For example, construct one like this:
Assuming there is a consistent and sufficiently expressive first-order theory at all, call it $T'$. The incompleteness theorem gives us that $\mathrm{Con}(T')$ (the consistency of $T'$) is not provable in $T'$. Hence $T=T'+\neg\mathrm{Con}(T')$ is consistent. Since $T$ proves that we can derive a contradiction from $T'$ alone, it also proves that we can derive it from $T$ (because $T'\subset T$). So $T$ is consistent but proves $\neg\mathrm{Con}(T)$.
How to think about such a strange theory? Obviously the theory $T$ is lying about itself. But what does this lying mean mathematically? Are the formulas and deductive rules interpreted in the language of $T$ different from the one in my meta theory? Can I trust $T$'s ability to express logic, deduction and arithmetic at all?
Note that a theory $T$ as above is just an example to demonstrate that such strange theories might exist. It might be hard to argue about the usefulness of a theory with such a complicated and highly dubious axiom as $\neg\mathrm{Con}(T')$. But not all such self-falsifying theories must be so obvious and artificial. For example, it could be that ZFC can prove $\neg\mathrm{Con(ZFC)}$ while still being consistent. But how can we trust in a theory that fails to mirror our logic even when we try to implement it carefully? How can we be sure that all other theorems on logic derived in ZFC are trustworthy despite ZFC proves at least one wrong statement (wrong in the sense that our meta logic gives us a different result than the internal proof logic of ZFC)?
If I understand correctly you problem the key to solve it is to think carefully to the concept of encoding.
For simplicity allow me to consider the case where $T'$ is PA (Peano Arithmetic).
The internalization of the syntactic properties of PA in itself uses an encoding which is roughly a mapping that associates to formulas and proofs constant terms (their encodings) and to meta-theoretical properties ("$x$ is a proof of $y$ in PA", "$x$ is provable in PA", etc) formulas in the language of $T$ in such a way the following holds:
The important thing to keep in mind is that this encoding-condition is required to hold only for encodings.
Now let consider a theory $T=PA+\neg Enc(Con(PA))$ in the language of arithmetic.
Clearly $T \vdash \neg Enc(Con(PA))$ but what does this mean? By soundness and completeness this is equivalent to say that in every arithmetic structure $M$ which is a model of $T$ it must hold $M \models \neg Enc(Con(PA))$. We have that $$Enc(Con(PA))\equiv \neg \exists x\ Enc(\text{*is a proof*})(x,Enc(\bot))$$ hence $$\neg Enc(Con(PA)) \equiv \exists x\ Enc(\text{* is a proof *})(x,Enc(\bot))$$ so in each model $M$ of $T$ there is an element $m \in M$ such that $$M \models Enc(\text{* is a proof *})(m,Enc(\bot))$$ the problem is that this $m$ is not an encoding, it is not even required to be the interpretation of a constant term, hence there is no way that we could decode this term to a proof (in PA) of $\bot$.
The point is that the formula $Enc(\text{* is proof of*})$ define a relation for each arithmetic structure but it has its intended meaning only when applied to encodings: meaning that $Enc(\text{*is a proof of*})(m,n)$ expresses that $m$ is the encoding of a proof of the formula encoded by $n$ only when $m$ and $n$ are encoding.
The argument shown here should be easy to adapt to other kind of theories such as the ones you described.
I hope this helps.