If the boiler has output terminals for the pump you must wire the pump via the boiler.
The way you have wired it means the pump will only come on when the valve sends the output to the boiler to fire. When the boiler cuts out when it reaches temperature the water still sitting in the heat...