Genre tells you where you will find books on a shelf in the library, but theme relates to deeper messages within books and stories. (See here for a reminder about genre.)
You might have three books: a fantasy, a mystery and a humorous story and they could all have a central theme about friendship. Or they could all be about betrayal, or any of the other themes.
So theme doesn’t depend on genre although some genres will be more likely to have certain themes (e.g. adventure stories often have a central theme of life and death or good v. evil).