Learning music theory is a great way to better understand the nuts and bolts of how music works, broaden your horizons and give you a bunch of tools to make interesting and varied music, but won't in itself teach you how to write; much as how studying creative writing theory won't teach you how to come up with a great story. Imagine studying creative writing theory without ever actually applying these analyses to great works of fiction... Studying music theory only really has value insofar as it helps you understand musical works, be they those of others or things you've come up with yourself.
What learning music theory can do for you is help you to understand what is going on in the music that makes it sound the way it does. Different uses of the elements of music all "feel" a different way of course. Our musical intuitions can tell us what we like, what we don't like, and how isolated parts of music (say a couple of chord changes or an interesting rhythm) affect us. Theory can help us more accurately pin down what is going on, form some more generalised perspectives, and apply what we've learned to other areas. It can allow us to deliberately make conscious alternations to something we've come up with by ear for example. When I'm writing a harmonic progression for instance, I might start with some idea that I "hear", but then use my knowledge of music theory to know "where to look" to find things to add to it. But those theory rules only help me because they're always grounded in a subjective feeling of what the applications of those rules actually sound like. When jamming or co-writing, a bit of or a lot of theory knowledge is a great help for the same reason: it lets you know where you are, and what options are available to you in terms of where to go next.
Songwriters end up using all kinds of weird linguistic devices to try and describe what different patterns of sound are like. Sometimes it can end up sounding a little enigmatic or just pretentious (I knew a lyricist who used to talk in riddles all the time, he'd say things like "I'm trying to get the chorus to sound more agitated", you know, at the moment it has this kinda rainy day vibe but I want it to sound "sharper" you know, more brittle..." when co-writing, and often I'd get what he meant and be able to make changes accordingly. There's a reason people use taste, colour, texture, visual, and spatial metaphors for sound, because they're trying to put into words what certain music devices conjure up. As you expand your knowledge of theory it gives you a wider palette of ideas to draw from: you might call it expanding your tonal vocabulary?
Having said that, some people can write amazing music without learning any formal theory, but generally it's because they have worked out their own understanding of what's going on in the music they are influenced by, by learning it by ear and learning what's going on (even if not knowing the official "definitions"). Once you internalise things enough, you can hear what a lot of things will sound like before you actually play them (not just melodies and individual notes, but complex structures). But this ability will come from practicing learning and making stuff up as much if not more than from written sources.
Lennon and McCartney are a great example of a songwriter duo who knew very little "formal" theory. However, what people often miss is that they were extremely literate in the music of their day, learnt a huge amount of music by ear, and played around with songs they liked all the time (and by that I mean they would make modifications and adaptations in what they played and just generally "have fun" with existing music). That gave them a framework of harmonic, melodic and rhythmic language with which to work (with a couple of true innovations too, see Alan W. Pollack's work).
Similarly, if you are writing, and you try something random, or hit a wrong note, or deliberately try changing a few notes here and there and stumble across something that sounds amazing, then you might find if you go to the literature, you will find that what you've just done is in fact "a thing". You might find that the way it's described doesn't really seem to apply to what you've done, that's OK, doesn't make it any less valid. But you'll probably find basically a description of something you wrote, and also a whole group of similar devices that interest you just as much as the thing you've stumbled across. This more than anything, to me, is where reading about theory becomes interesting, and useful.
Of course, you might find that the way you like to think about it isn't necessarily exactly what the book says. That's fine too, of course, music theory isn't (yet) an exact science.
The most important thing is to study MUSIC. Play songs, and work out what's really going on. Learn songs, or fragments of songs by ear. If this is something you aren't yet that comfortable with, start very simple.
Take an acoustic guitar song in G, for example. You take the chords and label which is the tonic, which is the dominant, which is the mediant, which is the submediant etc. etc. etc. I'm not saying that's not important or useful, but could you play that song with a capo on 3, a capo on 5, a capo on 7, a capo on 10, and have it still come out at the same pitch as the record? Would you have to sit down and think about it, or could you do it pretty much instantly?
I have no idea what your existing level of theory is, but the reason I give this example, is because I know people who can tell me a bunch of scales and modes they've "learnt", but if I ask them to play a "Under the Bridge" in C instead of E, they wouldn't even know to begin: to them, each chord is just a magic position to put your fingers in, which doesn't necessarily share anything with another chord. So despite all their theory "knowledge" from memorising scales, they've pretty much not yet taken in anything meaningful from any song they've played for fun, because they have no idea what the chords actually are, and how they relate to each other.
Something simple like being able to work out a song by ear, or being able to fluidly transpose from one key to another forces you to a certain extent to understand the music you're playing, because you will inevitable notice patterns, and begin to predict where things are going. This in itself is the key to writing, but reading about theory alongside is also very beneficial.