Of course there is ego involved in this reaction. Things in an op shop are essentially unwanted - items past their prime, or simply surplus to needs. You know yourself when you are having a clear out and just want to get rid of things, commonly referred to as "junk". It stings just a bit to think that your book, that once graced somebody's bookshelf, has been looked at, considered and then turfed into the "donate" box. Once you get past this little dagger to the heart, however there is a more positive way to look at featuring on an op shop shelf.
In the same vein, being recycled to an op shop means your book is getting a new life. As much as we like to think our books are dog eared from being re-read on a regular basis, the reality is a majority of readers do only read books once and they probably sit untouched for years at a time on a home shelf. Worse still they may be stuck in a cupboard, or in a box in the garage. At least in an op shop they have a chance to be opened, flicked through and hopefully read cover to cover. It means your words are released into the world one more time.
Some writers may feel that seeing their book sold second hand anywhere is lost revenue, and, of course, this is true to some extent. But the other side of that equation is that you are supporting another business, generally either a charity which is helping the less fortunate or a small, local business. It is actually an honour to have something that you have created seen as worthy to sell more than once, whoever gets to financially benefit after the first sale. And, on the bright side, all the best selling authors in the world feature heavily in second hand book sales. So at the very least you are in good company.
By all means feel that small stab of rejection when your see your book being sold secondhand somewhere but then take pride it's still out there and considered saleable in the fist place. And feel happy it didn't end up in the recycling bin.