It is not a bug; Panda caches scene graph transformations for performance reasons. The transform cache is garbage collected once per frame, which is usually enough (it is rare to do tens of thousands of transforms per frame).
There are two ways to avoid this. First is to disable the transform cache altogether:
from panda3d.core import NodePath, loadPrcFileData
loadPrcFileData("", "transform-cache false")
ralph = NodePath('r')
while True:
h = ralph.getH()
ralph.setH(h + 1)
Second is to garbage collect it periodically:
from panda3d.core import NodePath, TransformState
ralph = NodePath('r')
while True:
h = ralph.getH()
ralph.setH(h + 1)
TransformState.garbageCollect()
Note that you normally don’t need to call this as Panda calls it every frame.