Code shares have no real advantage for the passenger. Only for airlines. This said, most of the times it makes little differences, apart from the examples above.
Still, at the end of the day, it's not like it's worth to go to great lengths to avoid codeshares if they cannot easily be avoided. Not usually worth spending more.
One case where it is important to avoid them: if planning to use Star Alliance upgrades. Which only works for flights booked under the original operating airline flight number. But these usually entail a B ot Y fare which are usually more expensive than one cares for.