He probably uses dye for the color. As for not balding that’s fully genetic. Some people are blessed with a full head of hair until they die. Others lose it at 20.
While I can't say Ewan can only look this way because of medical intervention, the vast majority of major entertainers have work done in some way to maintain their looks over time and if they keep up with it you would never notice.
Surgery isn't the only solution, there are medications, like Finasteride, that actually prevent hair loss by blocking the hormone that causes it. But some people do just have thick gorgeous manes their whole life without help.
My brother is as bald as the day he was born. I, however, have a wonderful mane. He’s only three years older than I am, but he lost his hair a long time ago.