There have been at least a couple of times where I Googled something for the purpose of finding an answer to a question I had, and one of the links on the first page of results was either here or MO, which contained an answer to my question. I am surely not the only person to which this has happened. Thus, I would say it is certainly useful to post answers here, even if for the sole purpose of making them available on SE.
That being said, my feeling is that there are other online resources better suited for this purpose. For example, Proof Wiki. I personally haven't used this site myself, but it seems like it would make sense to contribute there if you are looking to "Write down a statement of a problem and its solution.". On the other hand, certainly not every question that appears on here would be appropriate for Proof Wiki, but certainly Proof Wiki is not the only alternative.
Although I've never made use of the feature, I had just assumed that the ability to answer a question yourself was to be used in the case where you had posted a question, and then later, before another user posted a full solution to a problem, found a correct solution, and posted it to answer your question so that others on the site could make use of your solution as well. For that matter, it provides an excellent way of closing the question, as there is no reason to leave it open if you've found an answer yourself, and this is certainly more constructive than just deleting it from the site.
Despite this assumption, I don't see anything wrong with posting the question and answering it at the same time, although, as mentioned above, it might make more sense to do such a thing on community sites whose purpose is providing reference material itself, instead of on a question and answer website.