You seem to be describing water hammer, caused by vibration due to the shock of water under pressure being shut off quickly. The most likely cause is a faulty valve, causing friction and travelling down the pipes. You can try closing isolater valve to the toilet so its 20% open then flushing the toilet and seeing if the noise fades (all be it is going to take 3 times longer for the toilet to fill up). If this fixes the issue, replace the toilet inlet valve which is attached to the float.
If that doesnt work another option is to try and bring air into the pipes to help combat water hammer, this is done by shutting off the water valve, turning on the taps on downstains and letter the water drain to a dribble, shut off the taps, turn on the mains water again, and turn on in the upstairs and keep it running until the water comes out steadily, then turn on each tap and shower\toilet to remove any air, at which point you should no longer notice the water hammer.