Forward-port the plan state check from the 0.9 series. 0.10 has improved the serial handling for the state, so this adds relevant comments and some more test coverage for the case of an incrementing serial during apply.