For your info, one of the possible problems, among others, I was looking at was a leaking single handle faucet inside the faucet itself which allows crossover of hot and cold. You could run cold water in the kitchen sink and the pressure differential across a leaking valve at the kitchen or tub would pull hot water into the cold line and vice versa. Try to feel the piping as close as you can to any of these faucets to see if running a faucet somewhere else causes a bleed over. Electric washing machine valves are prone to leak over so check those lines and your wash water temp. Some houses have tempering valves the mix cold and hot that could be bad. Also check the hot water line about 18" above the water heater for heat cause newer and better hot water heaters have a nipple with a ball inside to help trap the heat inside the water heater but not all have them and not all work right.
As Harold indicated the sensors as well as the thermostats on the water heater could be acting erratically, so could the sensor on a temperature control valve at the tub could also be erratic. A thermometer should help diagnose that by checking the water temp coming out of the water heater drain valve. One of the elements or thermostats in an electric may be acting erratic or the same for the gas valve on a gas water heater. Since someone may mention it, your new water heater is too new to have a broken dip tube and that don't fit your symptoms anyway.