
Of course he needs to learn to be alone sometimes, so occasionally confining him to the room where his bed is with a child gate is good for him, but if they are happy having a comfy nap together it is good.
I had my dogs around toddlers, and made it a rule that dogs and children did not play together as both types of games are inappropriate for the other.
Their time was for quiet things, a cuddle etc. This meant the dogs always knew they should be calm and quiet around children, even if they were running around being exciting. This makes things a lot less stressful when you are out with your dog where children may be running about and screaming, and also when other people kids visit who do not know your dog or dogs in general and do not know how to be around them. On the other side I think it also makes sure the kids do not view the dog as a toy.
To this end the garden was fenced across to provide the kids with dog free area so they could play without worry of stepping in anything and the dog interfering in their games/getting excited and knocking them down or scaring another child.
The dog should also have a child free area that it can go when things get to much.