Say you are riding in the flat. You see a hill coming. You try and keep your cadence.
Your cadence drops, you shift. It drops again, shift again.

You're in the big ring and getting towards the big end of your cassette: You shift to the smaller ring and up-shift a couple in the back, then continue to down-shift if your cadence drops.

On an uneven incline, you might be shifting all the time, and trying to keep your cadence moderately high.

Yep, unfortunately you still do the work.

Never mind what others do. Enjoy the day where a guy passes you, all-out (it's usually guys who do that), and then he fades and you catch him, but it might be another little while until you manage that.