Loss in converting YUV to PNG
The PNG format is lossless for RGB24 image data.  However the conversion from YUV to RGB24 is not lossless, as the two formats quantize the color space differently. 

To see this, the following animated gif was made by applying your two ffmpeg operations 200 times back-and-forth and collating the resulting 200 images into the gif.



By contrast, the following gif was generated using yuv444p as the YUV format instead of nv12. This format does not do subsampling / as much quantization.