I play guitar mainly (occasionally piano) so I will answer this question from a guitarist's point of view. I also write songs - both lyrics and the accompanying music. I don't actually write the music down - other than the chords, but I compose it on my instrument and record it on my Boss BR 800 Multi-Track recorder to save for posterity.
For me personally the most valuable application for the skills I develop by learning scales, is the ability to improvise and be able to instantly play fills, licks, or solos over or between chords in a song. So if I am playing with other musicians and there is someone playing the chords on guitar and maybe a drummer and a bass player, if I know what key the song is in, and I know the appropriate scales that correspond to that particular key, then I know which notes I can play that will sound right in the context of that particular song.
Or if I am playing solo, I can use this knowledge to add some color or spice up my arrangement by adding a few fills between chords or simulate a solo that occurs in the full arrangement for that song.
Knowing some scales also helps me in composing the music for my original songs. It helps in finding the notes for the basic melody as well as adding fills, runs and lead solos during my arrangement when I start embellishing the recording of my demo.
I also find that practicing the scales, improves both my right hand and left hand dexterity. I will practice playing them backwards and forwards at various speeds and with different picking patterns (down down down vs. down up / down up etc.). So I get the dual benefit of learning a set of notes that I can use for playing or composing a song - while enhancing my physical playing skills at the same time.
I find learning a scale for multiple keys is easier on the guitar than on piano. When you play a particular type scale (major, minor, Lydian, Dorian, whatever) on guitar, the shape of the patterns look the same no matter which key (A,B,C etc.) you are in. But on piano, the number of white keys verses black keys will change with each key so you must memorize 12 times as many patterns to learn a particular scale in all 12 keys.
For a more detailed discussion on how learning just one particular scale on guitar will allow you to play improvisational lead solos and fills and runs and licks (or whatever you want to call them) on the fly when playing with other musicians - take a look at my answer to another question on Music Practice and Theory by clicking here Using Scales to play lead solos and fillsUsing Scales to play lead solos and fills In this link you will also find a brief example of how easy it is to change keys once you learn the basic pattern of a particular scale on guitar.