Yes. You can have, for example, a Friedmann universe filled with nothing but electromagnetic radiation. The light’s gravity, due to its energy-momentum tensor, is the only gravity determining the dynamics of that cosmology.
Our own universe, which we believe is homogeneous and isotropic on the largest scales and thus can be modeled using the Friedmann metric, had an early radiation-dominated phase. The gravity of electromagnetic radiation was very important in determining the rate of expansion during that phase. However, theThe “radiation” then also included ultrarelativistic particles with mass, so it wasn’t 100% “light”. But the form of its energy-momentum tensor, and thus its gravity, was almost the same as if it were, because everything was traveling either at or very near the speed of light.