x.265 encoder produces reconstructed yuv video file after decoding
[..]
it generates HEVC file for you along with reconstructed YUV file
Let me clear this up a bit. Yes, x265 (and other encoders) can create a YUV file during encoding. However, it's not for decoding purposes. It's for debugging purposes. The purpose of an encoder is to create a video stream that can be decoded by a decoder. In order to do that, the encoder and decoder need to agree on an intermediary exchange format, i.e. the standardized bitstream format.
This might seem obvious - in this case, I mean HEVC - but you have to understand that encoders (and decoders) can have bugs. How do you find these bugs? You test! How do you test? You look at the bitstream generated by the encoder, and the YUV representation that the encoder believes the decoder would have created while decoding. And then you decode the file using an independent decoder, and check that the 2 YUV files are identical.
The important thing here is that the encoder didn't actually decode it. Rather, the YUV is the actual internal bitmap representation that the encoder believes should be reconstructed by a decoder given the block/mode choices specified in the bitstream. The encoder never decoded. It just reconstructed the bitmap as it believes the decoder would have done, and then encoded the reconstruction information in the bitstream. (And for reference frames, the bitmap is then used as a target reference for subsequently encoded frames.)