I first started writing plugins when I was two years into working with the WordPress platform.
I generally write to “scratch an itch”. That is, I write software to deal with a particular situation I encounter. I once wrote several MediaWiki modules, including one to restrict scripted registrations that all used a common nonsensical pattern (a capital letter followed by two, three, four or five lower case letters or numbers, repeated twice) for the login name. (The same script may still be in use, or, at least a variant of it, as I saw the same user names in a forum user list just recently.)
When I writing blog posts using WordPress, I wanted a means of entering non-traditional characters into the edit window, such as é, …, © and ¼. The regular interface offered nothing applicable, so after some searching I discovered a plugin that did. Sort of. The number of characters was extremely limited and I set out to modify it for my own purposes. That led to the creation of the Unicode Character Keyboard plugin, which evolved far beyond my original design, including a lot of research into plugin design and coding, proper plugin operation, Unicode characters and more. I learned a lot over the months I worked on the plugin, and I am glad that it has received some small measure of use.
When I moved over to the WordPress platform, that same sentiment came with me along with the desire for security. That was the impetus for the WP Security Log plugin. I had already found a plugin that did something like what I wanted, but I eventually learned I wanted it to do more. I was especially interested in logging and analyzing the events, which became a convenient reason to delve into the WP_Table class, and very fruitfully, too.