Yes, Play Safe is the story of the boy leaving the backyard onto a train with his dog saving him.
The one I’m trying to find is the first story line with the boy taking an engine from a train yard.
That's in the middle of the cartoon about 3 minutes in - the boy smacks his head against a rail and imagines he's in a yard full of bizarre looking streamlined steam engines, finds one to his liking and takes it out for a joyride. Some nightmarish action takes place, and it looks like the boys' engine is going to run into another locomotive when we're brought back to reality, the dog breaks loose and saves the passed out boy from a grisly demise...