Magnetic helicity generation from the cosmic axion field