Under the "standard" assumption that the potential is only a function of $x$ and the kinetic energy is quadratic in $p$, the equality $T(p) = V(x)$ clearly cannot hold throughout all of phase space. Allowing $V$ to depend on $p$ would just mean that you write $V(x,p) = \frac{p^2}{2m}$ and have zero Hamiltonian, but it's rather unclear what system this could correspond to in practice.
However, "the" Hamiltonian is not always $T+V$. In fact, there is not a unique Hamiltonian describing a given physical system. Different Hamiltonians (even on phase spaces of different dimensions!) can describe the same physical system, and, if the Legendre transformation turning the Lagrangian into the Hamiltonian is not invertible, which happens when the matrix $\frac{\partial L}{\partial \dot{q}^i \partial \dot{q}^j}$ is not invertible, the corresponding Hamiltonian system is constrained and is generically not well-described by a Hamiltonian of the form $T+V$.
In fact, the Hamiltonian generically vanishes for systems where you have chosen a "time"-reparametrization invariant action, where "time" does not necessarily have to be the physical time, it's just the integration parameter of the action. For a general discussion of this phenomenon, see this answer of mine, for a specific example of such a system arising in "practice", see this question.