Normally a diesel engine has a solenoid for shut off.
When you turn the key on it causes the solenoid to open letting fuel to the pump.
You might have had a sticking solenoid. ???
Years ago I had a CAT engine in a Boom Truck. Once warmed up if I shut it off for any length of time the pressure would build up and it would not re-start until cooled down or I opened a fuel line and drained pressure on the solenoid.
I learned to shut it off then turn key back on if I was going back out with the truck.
At the time I was too broke to replace the solenoid!