Unless you're manually forcing a keyframe cadence in some way, the output keyframe placement can't be guessed without passing the frames through the encoder.
You can force more precise keyframe placement by dropping the -g
and adding -force_key_frames expr:gte(t,n_forced*3)