Recent elaborated by Harko et al., the f(R, T) theories of gravity allow one to contemplate an optimistic alternative to dark energy, for which R and T stand for the Ricci scalar and the trace of the energy-momentum tensor, respectively. Although the literature has shown that the T dependence on the gravitational part of the action - which is due to the consideration of quantum effects - may induce some novel features in the scope of late-time cosmological dynamics, in the radiation-dominated universe, when T = 0, no contributions seem to arise from such theories. Apparently, f(R, T) contributions to a radiation-dominated universe may arise only from the f(R, T-phi) approach, which is nothing but the f(R, T) gravity in the case of a self-interacting scalar field whose trace of the energy-momentum tensor is T-phi. We intend, in this article, to show how f(R, T-phi) theories of gravity can contribute to the study of the primordial stages of the universe. Our results predict a graceful exit from an inflationary stage to a radiation-dominated era. They also predict a late-time cosmic acceleration after a matter-dominated phase, enabling the f(R, T-phi) theories to describe, in a self-consistent way, all the different stages of the dynamics of the universe.