"What is the mechanism that allows gravity to latch onto a photon?"

Think of a photon as being 'something', whatever that is. It is defined by it's momentum which is a effect from its 'speed' and 'energy containment'. If it is 'timeless' which anything existing at that speed, consisting of matter, would be to us then nothing inside this SpaceTime would exist for it. This is assuming Einsteins definition of its speed as being 'c'. But it is a photon, nothing really 'material' so maybe that definition has nothing to do with it.

But any which way, we have yet to observe 'aging' photons from our frames of reference. And if it, as we observe it, won't age then it can't expend 'energy'. That means that, assuming a propagation, the photon is to us 'frozen in time', its 'metabolism' the same from source to sink.

Gravity is weird, we can play with it as thinking of it as a 'density', or 'gradients'. Gradients is probably a better description from the photons 'point of view'. What gravity does is that it lends you 'energy' or take it away, depending on your motion relative that gravity's potential. So when a photon moves against the gravity potential it redshifts, to the observer losing energy, or if moving with the potential blue shifts, gaining energy. But those effects are observer dependent, defined by your relation relative the 'photon' we assume you to observe. You might be able to see it the same way as in classical physics? Two cars colliding, or a car colliding with a wall, will give you a different energy, here letting the 'gravity' at each point of that photons propagation represent some 'energy' relative you. Not a good example but I'll let it stay for now

The point is that this timeless photon can't lose 'energy', but if it were to work against gravity's potential it would have to, intrinsically. And the only way it can avoid losing that energy is to move in geodesics. Gravity could be seen as when you blend colors, you see this mix of swirling colors as you blend, that's a little like gravity's potential on a 2-d plane as it in a way is a mix defined by the matter/mass, 'energy', and 'motion' locally. But you could also see gravity as something static, existing throughout SpaceTime, as some logical 'number space' defining its 'strength', using 'times arrow' to constantly adjust the numbers describing each point. Or as 'holes' and 'dips', whatever gravity is it gives only one 'direction' from where you won't expend energy, and the photon always follow that 'geodesic straight line'.

It's a weird subject.

==

There is one more thing. If we were to assume that 'gravity' could be represented by a collection of numbers, defining each point in SpaceTime, times arrow constantly redefining them. Would they then be observer dependent? I think they would.