Turning water on and off should have no effect on the T&P valve of the heater. A T&P is normally set to relieve pressure at 150psi, and nowhere should that be approached. Not sure what a tankless uses, but it should be similar. What you may want to do is two things: first, check your static water pressure...if it is over 80psi, you need a pressure reduction valve to lower it and an expansion tank; second, a hammer arrester may resolve the problem if the pressure isn't too high. A hammer arrester is easy to install: unscrew the hose from one end - at the washer is best, screw the arrester on, then reattach the hose to the arrestor and you're done.