Did it work well for you?
As far as I can imagine and theoretically evaluate such solution (counting pulses on the gearbox) I find it insufficient in some cases. There must be two requirements fulfilled to make this closed loop working as expected:
1. produce as many controlling impulses as your uC counter can store/count in time unit (depending on how many impulses you can produce, you can use counter overflow or just poll and reset counter values in fixed intervals)
2. read counted values as frequently as you can, so you can adjust pwm duty cycle as soon as possible
If you mix these two requirements you will come with conclusion that if your feedback loop produces many-many control impulses, you can shorten intervals between subsequent read & pwm adjust stage without losing precision. Eventually, your uC can make more conscious decision whether to speed up/down and by how much one of the dc motor channel. On the other side, if you produce few such impulses, you need more time to collect them or make decissions based on low counter values.
If your counting solution is located so far from the engine, and by far I mean it at the end of the speed down gearbox, you can lose precision, so eventually your robot cant make smooth corrections - is starts to fluctuate/pluck left, right, left, right or is unable to correct pwm duty cycle fast enough...
Cheers!