Richard Wagner made the technique central to his operas, and film composers adopted it widely. Each time a character appears, their theme returns, sometimes changed to reflect what is happening to them.
Leitmotifs help audiences follow a story emotionally. Game soundtracks use them to connect areas, characters and boss fights.
Using it in a prompt
Generate a theme first, then reuse its description in later prompts ("same horn theme, now slow and sad") to build a family of related cues.