After a long time, I finally came back to analysing this issue and embarrassingly found out that the exports were working, but I had two conflicting exports, through .zprofile and .xsessionrc for the same variable.
Also, I've noticed that for some reason, probably security related?, you can't simply inspect the LD_PRELOAD variable. It will always return empty.
Though the answer isn't much, I do feel it would be worthwhile to share how I tracked down the issue.
- My first clue was
.xsession-errors which properly logs all stuff related to X. In that file, I could see that LD_PRELOAD was being set twice on logon.
- After that, I just searched the exact line of code in all my files using
grep -rnw ~/* -e "export LD_PRELOAD". It clearly indicated the respective files which had the lines, .zprofile and .xsessionrc and I was able to fix the issue.
Update:
It seems that LD_PRELOAD was being unset by KDE after sourcing ~/.xsessionrc that's why export wasn't reporting anything. I've moved the export statement to ~/.zshrc for now.