OK, so I've just gone back to those two towns where I tapped two zombies, and have squished one more zombie in each town. My zombie total is now 10. So it does seem that tapping one of the next nightmare (in this case, zombies after skeletons) when you're close to the upgrade total counts as double and is carried over when you upgrade, before then reverting back to counting as one after the upgrade.
Not sure when this kicks in - my theory is that it happens when you reach the "upgrade campfire for zero donuts" options (which doesn't actually work). But I can't test my theory until the next campfire upgrade...