The problem is caused by a pressure drop in the cold water pipe that serves as input to the water heater. The pressure of that incoming cold water, is what pushes the hot water out. When you turn on another faucet or flusgh a toilet, there just isn't enough water volume to maintain the pressure. I solved this problem in my house by replacing the 1/2" copper with 3/4" from the meter, across the house to the opposite side, so that all the branches are supplied from this 3/4 inch pipe and there is now enough water available so that you can flush every toilet and turn on all faucets at once and the shower remains hot. The difference in capacity between 1/2" and 3/4 " is substantial. Visualize a hole the size of a dime and one the size of a quarter. I did nothing to the hot water circuits. In my case the fix was feasible because the line across the basement was easily accessible at both ends. I also ran the 3/4" pipe to the outside sillcocks, including new valves, and commercial sized hose. Watering the garden now takes half as long.
BB