OP, DS has eczema. Change in seasons, pool water, moving, lack of and too much humidity

all triggered him. It will be trial and error to find his triggers. Once you find those you will know how to treat him
When you put him in the long pj's: make him wear the same ones until they stand up by themselves. It sounds gross and they will never look clean again but it helps. The lotion cakes the pj's and it just helps the legs.
During the day: Pants, jeans anything long to cover up his legs so that he can't get to them to scratch.
Keep him hydrated. When DS does not drink enough water, he gets dry and breaks out.
Another thing that finally help DS, was claritin. Everyone in the family has allergies, but the allergies did not show up in the typical fashion. We theorized that DS was showing allergies atypical. He still breaks out but they are not as severe.
Good luck. I feel your pain and your child's pain. I have spent many a sleepless night "rubbing" DS legs so he would not and he could sleep.