Play is something we may think of as a purely pleasurable, recreational activity, but for the wider animal kingdom it has a much more vital purpose — particularly for animals like dogs who have long owed their survival to their ability to work together as a social group or pack.
Play is really part of the social glue that keeps them together, which is why you tend to see it so often in dogs who are related, live together, or have otherwise forged a close social bond when they were younger.