> Photons don’t have mass so don’t cause gravity but are affected by it.
They do have momentum though, and their momentum flux is encoded in the stress-energy tensor, which up to constant factors forms the right-hand-side (the "source" or "matter" side) of the Einstein Field Equations of General Relativity.
So photons are a source of curvature, and thus to say that they "don't cause gravity" is wrong.
This has been known since the late 1920s, and was made very clear in some correspondence between Einstein and Bohr on the topic of "Einstein's box" (box of light).
See e.g. the following subsection (and the figure it refers to) https://en.wikipedia.org/wiki/Bohr–Einstein_debates#Einstein...
A more extreme case is https://en.wikipedia.org/wiki/Kugelblitz_(astrophysics)
In flat spacetime, we can alternatively start by considering the special-relativistic dispersion equation, E^2 = (mc^2)^2 + (pc)^2, m being intrinsic mass and p being momentum. Usually you see this as E = mc^2, taking square roots and considering the centre of momentum to be fixed. When you let a beam of light (or even a photon) travel across a set of coordinates, rather than keeping it fixed at some coordinate (e.g. the origin), p is nonzero, even though m is always zero. Since (pc)^2 is positive, so is E^2, so even though light is massless, it has (frame-dependent) energy. Indeed, being more formal, one says that light has momentum-energy. A further relationship E = hf, h being Planck's constant and f being the frequency of the beam of light (or just a photon), also underlines this: E = hf = pc^2, so the momentum of light relates to it's frequency, or alternatively it's wavelength (as f = c / lambda, where lambda is the wavelength). Light's frequency is observer-dependent because of relativistic doppler effects or equivalently light's wavelength is observer-dependent because of relativistic length contraction. (And this should not be surprising as even in high school physics you will have learned that kinetic energy is a frame-dependent dependent quantity. Relativistic kinetic energy is E.)
When we add gentle curvature and use suitable coordinates, E is simply promoted into the time_time component of the stress-energy tensor. (Gory details if you look up "comma-goes-to-semicolon rule", which you can find discussed here https://ned.ipac.caltech.edu/level5/March01/Carroll3/Carroll... or in most decent textbooks on General Relativity. Carroll prefers to call it the energy-momentum tensor instead of the stress-energy tensor; they're the same thing.)
Since any nonzero component of the stress-energy tensor serves as a source of curvature, then light must generate curvature.
You were half-right though: photons do indeed respond to curvature.