Double counting because of gross mixed income
According to the scenario Mr. X is an employee of XYZ and not the owner of the business (sole proprietorship).  So his $50 dollars won’t get count towards his own earnings.  It should get counted toward Gross Operating Surplus. 

If he was the owner of the business then it still wouldn’t be counted under compensation of employee for Mr. X because at that point he would not be an employee.  It would be counted toward Dr. Y's earnings.