I had a basic chord structure in mind and then experimented at the keyboard to work out the best notes to add to each chord.
I think you may have answered your own question there!
The fact that you experimented and "found" the notes that sounded good is what most people do without a deep knowledge of harmony
To many this is the "joy" of songwriting - the feeling that you have "discovered" something
In reality most things that "sound good" to western ears is very likely to be explainable with VERY simple music theory
However, I personally think a good grasp/knowledge of music theory is a very powerful tool in a songwriter's toolkit
I like to think of music theory as a map or "sat nav" when travelling on a car journey
Some people like to just set off on a journey and find their own way to a destination
Some people like to meticulously follow a sat nav and not really think about anything whilst driving
Some people like to just have it there as a "safety net" in case they get lost
Sat navs can also be used to find completely new ways to get somewhere, which take in breathtaking scenery and open up a whole world of new ways to get somewhere
Even is you don't follow a sat nav or map you could always use one to review your journey and understand how you got where you did and note any particular areas of interest along the way - in the same way that music theory can ALWAYS explain why something "worked" or didn't work
I have spent a lot of time learning music theory by gaining my Grade 8 in guitar and I have recently completed an advanced diploma in music theory
I am currently in the process of putting together a "scheme of works" / lesson plans to distil music theory down to the essentials that I think songwriters and producers would want to know (which I will be testing with members of the forums when I get something down!)