There is nothing unethical about the behavior.
The person who waits in line on the first floor has spent his time. The person who walks up the flight of stairs to catch the elevator on the second floor has spent his labor (and some time). I don't see, a priori, that more-time-spent-plus-no-labor should be considered more valuable than less-time-spent-plus-labor. Further, the person who waited on the first floor had the option of walking up to second floor just as David did.
If David's behavior is unethical, then so too is the behavior of the person who got out of bed 15 minutes earlier for the purpose of arriving at the elevator before the line formed.
Interestingly, if more people followed David's example, then a line would form on the second floor as well. This would encourage people to walk up to the third floor to "jump" the line forming on the second floor. As lines
formed at each of the floors, people whose destinations were lower floors would end up not taking the elevator at all.