I didn’t always listen to country music. I grew up listening to it because my parents listened to it and I didn’t really have a choice. Then around age 13 I decided to see what else was out there. I would go to the music store in the mall and spend hours listening to the music they had available on the demo player.
I would pick one, go home, and listen to the whole thing over and over again from the time I got home from school to the time I went to bed. I went through a punk phase where all I would listen to was Simple Plan and Good Charlotte. During that time I also started skateboarding, playing playstation, and giving my parent a hard time. Think it had anything to do with my musical selection? I also went through a rap phase which I really don’t like to talk about and I’ve tried really hard to forget.
All of that to say, you don’t always have to listen to the genre you write for. I write mostly country tunes but listen to plenty of other genres of music. Maybe you’ve only ever listened to rap but you want to try and write a pop ballad. There’s nothing stopping you although I do recommend listening to several pop ballads before trying to write one.
The main thing when trying to write for a different genre is listening to music from that genre for a while before you try and write in it. Dissect the songs. Listen for lyrical content, song structure, instrumentation, and tone. You’d be surprised how much you can learn from listening through the top 5 songs in the genre.