An upload arrives with a claim about what it is, and that claim is made by whoever is uploading. Keeping it is reasonable — it is genuinely useful to know what somebody thought they were sending. Serving the file back under it is not.
A file served as text/html from your origin is a page on your origin, with your cookies and your permissions, written by whoever uploaded it. Nothing about the file changed; the header did.
GET /documents/d4The same bytes both times. Compare the content-type each build sends, and where it says the type came from.