Required permit/expansion tank/inspection
Here's the deal.
When you heat water, it expands.  If it can't expand freely, it increases pressure.
When you're on city water, that's no big deal.  The extra volume can just push back out the water main to the street - maybe an inch or two of water movement, not a big deal.  So there is no increase in pressure.
Imagine if we stuck a check valve on the inlet, so water CAN'T flow backwards to the street. Some cities actually want this.   Now what?  Now, water can't expand freely.  All the valves are closed, and the check valve prevents backflow into the city system.  Since water can't expand freely, it increases pressure.
Well systems effectively have a check valve at the bottom of the pump. That's to keep the column of water in the well pipe from falling back down!
So with all valves closed and the check valve on the supply, the system is &quot;solid&quot; with water - a state called &quot;hydraulic lock&quot;.
Water does not compress.  So, if volume increases, pressure must also increase, to infinity if needed, until something gives or breaks.  That is why a water heater on a well is a big deal. If normal pressure is 34 PSI, this can drive pressure up to 200 PSI or more until the weakest valve or pipe joint fails.
These high pressure instances can also be simply from slamming a valve shut fast.  Water has momentum and when it's flowing toward the valve and you shut it, it &quot;piles up&quot; at the valve causing a pressure spike.  This is also what causes pipe knock or rattle.
The solution is to have an air volume in the system. Air does compress.  So if volume increases (a little), the air compresses (a little) and pressure increases some tiny amount (like 34 PSI to 34.1 PSI).
The expansion tank is simply an engineered vessel with an air space and water space.  And a rubber seal between them, to stop the air from effervescing into the water and being lost.
We're talking a $40 item easily added.  It only needs one pipe connection.