The only synthetic fertilizers that include hydrocarbons in their production chain are ammonia based, but all CO2 (or as much as is practicable) is removed from the end product. It's really only used on the way to producing hydrogen.
Furthermore the ammonia production processes use natural gas (not crude oil!) only as a source of hydrogen. They could split water instead, it’s just that the natural gas is cheaper.