Your doubt is well founded. A three-dimensional space of thermodynamic states is justified only in the case of specific classes of systems. Generalizing a result valid for the ideal gas to every thermodynamic system is an unduly step. It is possible that somewhere in the text there was an explicit indication that all the statements were intended for the so-called simple systems. I.e. systems which, by definition, exchange work with the outside only through changes of volume. In practice, fluids without electric or magnetic effects.
Even a two-component perfect gas will require one additional variable (related to composition) to specify uniquely the thermodynamic state (notice that the equation of stat for pressure is not enough to discover this point).
In general, the proper choice of the state variables is strictly connected with the physics of the thermodynamic system. One has to discover experimentally what is a set of variables large enough to provide a unique description of the thermodynamic state.
A systematic way to find the independent variables is to analyze the independent processes which may change the energy of the system, i.e. the independent contributions to the differential of the internal energy. If we have neglected some process (and its related state variables) we will find that the incomplete set of thermodynamic variables will not specify uniquely the internal energy of the system, with possible apparent violations of the first principle of thermodynamics.