Experimental data suggests that it may all be about comfort.
Dogs recognize emotional odors from other dogs and behaviorally respond to them.