Apple, samsung etc only use the
sensor from sony. The lens is their own, the ISP lies within their SoC (exynos, snapdragon etc), these are non sony hardware pieces.
Sony's xperia phones use a separate discrete image processor hardware called bionz which they love to advertise as being just like the similarly-named processor in their professional cameras. In reality its probably responsible for the noise reduction results that makes even broad daylight photos have that fuzzy look occasionally at full res
Example (my own photo from my Z1 compact)
https://i.gyazo.com/599df5b0f65af65ba12bd99f9fe10ce7.png
Now on to the lens on the xperia. I cant say for certainty with the current Z5 generation but the older generations had
plastic lenses. Im not recommending to go to try this for real on a display unit but say if you use your fingernail and press hard into the camera lens. It will literally deform under pressure and bend inwards just from your finger's pressure.
Example of lens wear on xperia device
http://i.imgur.com/1jPleet.jpg
Also the polarizing coating wears off super easily (HTC One M8 famous for this problem).
So... yea I definitely do think sony's hardware isnt that top notch. The sensor is just 1 of the ingredients and its not enough. You could forego the sony stock camera app and use something else on the playstore like Camera FV5 or Proshot... different software, end result is still same (this is true for most phones, using a different camera app wont have drastic photo quality difference)