Is it ethical to slightly improve upon someone's unpublished work posted in arxiv and publish before the original work?
I question, as did Dan Romik, your characterization of work posted on arXiv as 'unpublished': it is made available to what amounts to the widest possible public, it is just an un-refereed publication (or perhaps arguably a kind-of very slightly refereed one, if you read the conditions). 

I suggest that the ethics of it depend on whether the later-published paper  acknowledged the arXiv paper as earlier work, or not. If it did, I see no problem.  

If the later paper made no acknowledgement, then maybe there is a problem if its editor/referee(s) happened not to spot the earlier paper in arXiv and took the whole content of the later author as original. 

But what the arXiv author could do in that event I could not begin to suggest. Best response would probably depend highly on the particular circumstances, which would no doubt be awkward to set out in this medium.