This was actually caused by two problems. The first is that the code actually deliberately detects if nothing happened and pushed an undo step, a bugfix for a problem that no longer exists. The second was that SCULPT_test_location sometimes does a closest point search instead of ray casting and didn't check the result against the brush radius.