Ben Franklin said “An ounce of prevention is worth a pound of cure.” It’s an old English proverb (as in Ye Olde) that goes back many centuries even prior to Franklin.
Counteroffers are now rampant. One out of every three offers involving recruiters (i.e. candidates that were not looking for a job in the first place) are resulting in counteroffers in my office and with our clients.
The only way to prevent a counteroffer from derailing three months or more of search work is to have the right offer presented in the first place. This means the strongest possible offer in terms of salary denomination, and perks, benefits, hiring/starting bonus etc. No low-balling, no slightly-less-offers, no let’s-test-the-waters offers, etc.