the horn is sounded as a warning !
some passengers/people on platforms are oblivious to non stopping trains and lean over the edge or items they are holding/carrying are precariously held in the line of fire of said trains.
Should someone be injured or God forbid killed, one of the first questions the driver is asked by the coroner is "did you sound your warning horn?" if not the driver is/can be charged with manslaughter.
As for
speeding upto a red signal I very much doubt that. These trains wagons have a minimum of four wheels (one on each corner) each with a brake block multiply by say 40 and add another 16 wheels with 32 brake blocks for the loco and thats alot of steel rubbing together.
And freight is what actually keeps the rail system alive, it is the money from freight that allows passenger trains to exist. The passenger services could not afford to finance all the infrastructure needed alone without pricing its services out of the reach of the majority of us.
It is the signalman that decides which train occupies which bit of track so they hold up your trains.
Not being funny (mean funny) I just thought I'd try and explain the reason for what seems an annoyance.