You have raised an interesting query! You have also unwittingly provided me with a topic for my next article.
'Were' can be a subjunctive mood verb, It is used as a subjunctive mood verb in the sentence provided by you. To understand it better you first need to understand what a subjunctive mood verb is. Subjunctive mood verbs are used when hypothetical declarations are made; for example, I wish I were selected to represent the country. It is a wish; it is not something that has happened. The verb 'were' is used along with the first person 'I' when we talk or write about situations that are untrue.
Similarly, your example states, I wish I were a writer. It illustrates that the person is not a writer, but wishes that they were one.
Underestimate me...that'll be fun!