Media composers almost always write for characters very different than themselves in situations far beyond their own personal experiences.

They get into the skin of those characters and inhabit them through music.

For example, to the best of my knowledge,
Hans Zimmer is NONE of the following:
A woman baseball player
A caped crusader
A black woman mathematician
A serial killer
A lion king
A lesbian police lieutenant
A Native American warrior
An astronaut
A web slinging crime fighter
A black slave
A Roman gladiator
A superhero from Krypton.
A race car driver
A zoo animal
A Chinese panda
A British sleuth
A thief who uses dream-sharing technology
A woman having an affair with her ex
A resigned US president
A drunken pirate
A Mexican woman participating in a talent show
A yellow skinned Nuclear Power Plant worker
A symbolist uncovering a major mystery
A British woman swapping homes
A Knight of the Round Table
A hustling shark
A Special-Ops commander
A phobic con artist
An American samurai
A swinger senior citizen
A wild stallion
A journalist investigating a killer video
A single mother
A secret agent
A Hebrew prince
A misanthropic author
A muppet
A mild-mannered chemist
A stalked baseball player
A preacher’s wife
A submarine officer
A Jamaican bobsledder
A toy maker
An abused child
An Arkansas waitress
A fire fighter
A lawyer recovering from brain damage
A mountain climber
A French man getting his green card
A black chauffeur
A savant brother

As far as I can tell, Hans has only scored two characters heavily related to himself:

THE HOLIDAY- a film composer
RANGO- a chameleon