I found a bitcoin wiki article on it yesterday but its gone now..
At the bottom of miner cpp it can also be seen that we hash the merkle root:
pblock->hashMerkleRoot
I don't think there's any other reason to do this unless that's what generates the merkle root but if it did it should be called findMerkleRoot.
If you look closely you'll find that hashMerkleRoot is not the only member being set though
Here you see the components of the block header as mentioned further upthread:
{
public:
// header
int32_t nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
uint32_t nTime;
uint32_t nBits;
uint32_t nNonce;
...with hashMerkleRoot being only one of various members set during the mining / block building process.
For example you can see the hash of the previous block, timestamp, difficulty target and an initial nonce being set here:
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
pblock->nNonce = 0;
And the version being set here:
And for good reason: The nonce nNonce is required to give miners a wide range of values that can be tried during the mining process. The target nBits allows the block to be verifiable in itself and seals the current network target within the blockchain. The timestamp nTime is required to calculate the upcoming difficulty change and makes time warp attacks more difficult. The hash of the previous block hashPrevBlock is necessary for ordering and puts the chain in blockchain. And needless to say hashMerkleRoot ensures transaction integrity. Accordingly you want to ensure the integrity of all of these parameters, hence they are hashed as part of the block header.