Definitely worth seeking medical advice to exclude organic causes. Headaches and tummy pain are common stress indicators but not joint pains. Has he been constipated at all? If there is any pain with toileting it can make them hold on (and on and on) which can also give headaches, tummy pain and diarrhoea (leaks around what is sitting there).
Hope it sorts itself out soon.
If it is any consolation a friend recently was telling me about the horrendous year her EG boy had in preschool (now gr 4). She asked him last week what he thought was the worst thing about preschool. He said one day she had told him she would put an apple in his lunch and she had put a banana in instead!