There was no way for you to 'catch him' before...he was going to fall no matter what you did, so don't feel too guilty. I've had snakes do this too...in fact, I've
had 3'+ corn snakes that rippled their entire body along the top rim of a larger (& taller) tank, and hang on really well. Corn snakes, admittedly, are better
suited to climbing, but even my round-bodied rosy boa will climb things. (-as they do in the wild, they climb into shrubs) One reason snakes escape their cages
is that they have nothing but time to keep trying things.
And yes, you could probably find something* to fit into the rim so he can no longer hang onto it. *Measure the gap & stroll thru the nearest hardware/home
improvement store, & when they ask if you'd like some help (assuming?) tell them what you're looking for. I know there is wood molding & wood dowels that
would work, but wood is porous & you have better things to do than coating it, so while it's easy to cut to fit, it might not be the best choice. A better choice
would be something made of plastic, and you'll also need fast-drying non-toxic glue to hold it in place. (put snake in a side cage when you do this & while the
glue dries...make sure no fumes remain before he goes back in) You might even have a fat old electric extension cord laying around that would work? I'm not
seeing the rim you're trying to fill in, but you get the idea? If that was me, yes, I'd modify the rim so he can't hang on & then fall again.