To prevent freezing of the PEX water lines in the attic I think you should consider covering them with a cover that would allow them to be kept warm from the space heating of the house. Insulation over this cover would prevent heat escaping into the attic. The cover would go all the way to the attic side of the ceiling and insulation would be removed from under the cover to that heat flow from inside the house can keep the pipes warm.
You report that putting foam tubing over the PEX lines did not work. The next thing to try would be electric heating tape, but covering the lines would seem to be a more permanent solution. I have never heard of covering of the water lines being done, but I have never heard of freezing of plumbing on the scale that is occurring in your house.
Whenever a valve opens and closes, it causes a pressure spike. This is because water is incompressible, so it tends to telegraph pressure spikes a long distance.
Water has mass. When you open a valve, the water has to start to move. That causes a local low pressure area which of course is what makes the water move.
When you close a valve, a significant mass of water (in the pipe) is moving toward the open valve. The water at the valve must stop, but the water behind it is still moving toward it. So it is compressed. All the water's kinetic energy is converted to pressure, in a millisecond. The water moving toward the open valve seeks any possible outlet for the kinetic energy.
It finds the pressure relief valve in the water heater.
If it hadn't found that, it could break a pipe.
A related problem is when it finds an expansion tank on the other side of the water heater, or some comparable "place for the pressure to go". Thus the pressure is relieved by water moving through the water heater. The tankless sees this water movement, and turns on.
In a city water system, the obvious place this pressure can go is back out to the street - where it can be absorbed by the massive city water piping. This is rendered impossible if a check valve (aka backflow preventer) is added to the system.
An expansion tank is designed to create an outlet for such energy.
Best Answer
Results vary. A tankless heater I've had for many years regulates the output flow to assure that the output temperature is as hot as expected, however, not all tankless heaters do this.
The "installation instructions & homeowners manual" document from Rheem for the RTEX-11 states the following (page 7):
Based on that statement I expect that you could manually reduce the flow by partially closing the hot valve on your tub filler until the output rises to a temperature you like. Or, if you don't want to worry about that, install a flow regulator device to force the issue.