What you’re describing is likely what is referred to as “water hammer” and it has to do with the changing velocity of the water inside the pipeline.