The double effective MP is why the 5X/6P are better. They have less pixels but a very large sensor meaning they capture a lot of light. MP over 8.X (whatever it takes for 4K) start too mean less, instead you need better quality pixels. You can see a lot of big players around the 12/16 MP range because after that it starts too lose some meaning because the sensors are already so tiny.
Ack, I'm aware of the impact of sensor size - the 5X doesn't have a 'very large sensor' next to Z5C though. They're both the same size;
Nexus 5X
12.3 MP, f/2.0 aperture, 1/2.3" sensor size, 1.55 µm pixel size, dual LED flash, IR laser-assisted autofocus, Sony Exmor IMX377
Z5C
The rear-facing camera of the Xperia Z5 is 23 megapixels with sensor size of 1/2.3 inch and an aperture of f/2.0, featuring a newer Sony Exmor RS image sensor, instead of the 20.7 megapixels image sensor which was used in all of its predecessors, starting from the Xperia Z1.
Also software, Sony makes basically everyones camera's but then someone like Apple/Samsung will take that and pair it with better software and the end result is something much better then what Sony has on their own phones.
This is a good point, we're not talking about Apple or Samsung here though - we're talking about the stock camera app on Android, which is something that can be installed on the Z5C.
Looking at other threads;
http://forum.xda-developers.com/z5-compact/help/z5-compact-nexus-5x-t3247205
the same thing about the camera keeps coming up, I've not been able to find side by side comparisons though. I'm not intending to try and call anyone out, or push that I think I'm right - I'm curious about the cameras on these phones as I was seriously considering the Z5C.