Did he lock the door as a matter of training? Is it possible he had a medical issue?
The doors have an outside lock. It can be manually over-ridden by the inside every 30 seconds (i.e., the pilot has to repeatedly press a button to keep it locked).
So, no, barring the extremely unlikely occurrence of a broken lock and a disabled co-pilot at the same time the pilot had to pee, this was done on purpose.
The info coming out says that the cockpit was locked when the pilot left. When he returned, he punched in the code to be readmitted. The copilot them hit the lock button to prevent the door from opening. That button will lock the cockpit for an additional five minutes each time it is pushed. No indication of any distress from the copilot who was breathing normally.
Deliberate act wihtout question.