I've several thoughts.
First is there a tempering valve on the water
heater? If so, it's bad or could be bad
Second is there a shower
faucet valve that is on but off at the shower head
Same thing if you have a deck
or stern shower with the shower head
off but the shower valves open. In either of these two cases you could get fluctuating temperatures from flow bypassing cold to hot side via the valve.
Can also get this "Feature" from a fancy kitchen sink faucet with a sprayer gooseneck. More an issue with real high end faucets.
Make sure all shower valves are off and see if you still have a problem. BTW installing check valves in the hot and cold water
at the shower valve solves that issue, should someone forget to turn the shower valve off.