I tested your code and it worked, I did not get these artifacts. Are you applying your model on these patches/tiles before rebuilding the image in the example image you showed?
The unfold function is equivalent to your split_tensor function with stride=tile_size and fold is similar to your rebuild function.