When you haven't placed the wheel in the pyramid yet, using a tomb ratchet places the wheel in the middle chamber without changing the lower chamber. However, mafia calls PyramidRequest.advancePyramidPosition() anyway. Unfortunately, the response text from using a tomb ratchet is the same either way, so the only way to handle everything is to also track whether the wheel is placed. That would either be set when the first ratchet is used, or when the noncombat is found in the middle chamber (text is a large block, found here on the wiki). I expect it would be stored in lastPyramidWheelPlaced or something similar, though a pyramidPosition of 0 could probably be made to work there.
Actually visiting the pyramid fixes pyramidPosition, of course.
Actually visiting the pyramid fixes pyramidPosition, of course.