The answer would be: regression
Regression is a defense mechanism that causes the person fall into earlier psychological stages when an unpleasant stimulus received. The person chooses to turn back rather than facing the problem, which was seems safer and easier.
In this case, the 6-years old child starts to wet his bed, a sign that should be found in the baby(earlier stage).