It is also effectively 'natural gas in solid form' - the main input to making ammonium nitrate is natural gas.The main cost is the cost of the natural gas, and there are huge worldwide markets for both natural gas and fertilizer. Therefore, from an economics perspective, natural gas and fertilizer are pretty much tied together.
Same as electricity and aluminium.
Natural gas is hard to ship - whereas fertilizer is easy to ship.
Since Russia has bountiful supplies of natural gas, and sanctions prevent it selling that gas to europe via pipeline, producing fertilizer and selling that to the rest of the world is a workaround.