After reading Robert's comment in the cython code at
https://github.com/sagemath/sage/blob/419f5ae5280eb124e56af80bee8328eb64f9cdc5/src/setup.py#L522 it's pretty obvious how to implement a python version (at least one that works on CPython):
import sys
def inject(s,v):
G = sys._getframe(1).f_globals
G[s]=v
This will inject a binding in the caller's globals dictionary, which is basically what the old style cython globals did. To make this a utility function we can use in "var" etc, we probably want to inject into sys._getframe(2).f_globals
It's still a bit of a hack, of course, but I think a more stable one than relying on deprecated cython behaviour (that cython kindly left accessible to sage).