XT1064 - 5.0.1 - Rooted - Issues with writing to /sdcard
I don't know if it will solve your problem or not, because I never actually had issues "writing" to the sdcard, but apps seem to have problems sometimes. here is what I did.

I am suggesting this method because you said you use TWRP as your recovery.

Get the TWRP manager and open it. 

If you don't have the version of BusyBox they use it will complain. I am not sure if it will work with any other version. I have CM12 installed, which comes with busybox, but the TWRP app complains, so I use the one they recommend. The one they use does update busybox (automatically if you have the pro).

It will then tell you that it can't write to the sdcard, and they can fix it. Click "yes" it will take you to the setting of the TWRP manager. Click on the option that says "Apply SD Card patch". This will reboot your phone.



Note that mine is disabled and says "Already applied or not needed". This is because I have ran the patch already.