I am closing the issue as "won't fix" as it is an edge case. When 404 is returned with no entity and media type is specified then expecting such a media type even no entity is in the response is the edge case. The media type (content type) is bound to the entity. The fact that we Web Container returns the HTML page is also ok as 404 is the error code and not a success response.
I have added tests when an entity is defined in the response for 404. In this case the container does not return standard HTML page but it returns the entity and media type is preserved.
Set the entity in the response a workaround.