R.M.
Hi Mama-
It sounds like there is too much going on in your child's life to narrow it down. From what I'm reading, I'd say he is not feeling comfortable and needs you, so give him snuggles.
To figure out what's happening, let's start with the formula. Pooping every 3-4 days is a long time. A baby should poop daily or no more than every 2 days. He is probably constipated and bloated. Talk to your doctor about changing formulas again.
Changing care providers or daycare centers can be a huge issue for even young children. He may feel anxiety about the new school OR he may not be sleeping well there and over tired. Asked your child's teacher what his sleep schedule is like there. I'd encourage them to keep a sleep log for a few days to see if he's sleeping well.
He could be teething, if so, his sleep issues should pass naturally in a few days, if they do not, it's probably not teething.
Do you use soothing music to help your child to sleep? I recommend music strongly to the parents I coach, (I'm a parent coach). Music playing on repeat through the night helps tell the child it's still bedtime and they are more likely to lull themselves back to sleep if they wake.
Bottom like, I think he's feeling bad and needs snuggles. I'd bet it's due to his diet and pooping every 3-4 days. Get that undercontrol, start using music to help him lull back to sleep and things should get better soon.
Good Luck!
R. Magby