Status: will not be fixed (alleged behavior)
The main camera of the Nexus 5X has an unusual orientation - according to the requirements of compatibility with Android, the long edge of the sensor should coincide with the long edge of the device, which means that the sensor is oriented both to the landscape and the reverse landscape. Most Android devices have a landscape sensor, but the 5X has a reverse landscape.
Since most devices are identical, many applications incorrectly check the orientation of the sensor and apply the correct settings. If you more or less copy the sample code here:
http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation(int)
for the old camera API, it must set the correct orientation for all types of devices (phones and tablets), the orientation of the sensor and the camera lining (front or rear).
As you already noted, the JPEG orientation should also be set, but this has always been a requirement, so fewer applications are becoming erroneous (since phones are often held in random orientations, even if the user interface is forced),
The camera2 API is intentionally more user-friendly here - if you use SurfaceView, the API ensures that the preview is correctly oriented. Unfortunately, we cannot fix the old API to do this for you.