The code in questionThe code in question was not generated by Stack Exchange. It was generated by a user.It was generated by a user.
So, yes, quite often, the HTML (and all other code samples generated by users) will be malformed.
However, in this case, note that <li>
tags are not required to have closing tags. I agree that it is bad form to leave them off, though.