There is a key phrase in the original problem statement that is absolutely pregnant with meaning. It says, "A gentle horizontal pull is exerted..." Now, without saying so in so many words, what this is tell the reader is that this is a problem involving rolling friction, not sliding friction. This makes all the difference in the world.
Because the Yo-Yo rolls (that what the problem said, indirectly), the point in contact with the horizontal surface is a point momentarily at rest. This is what makes it permissible to sum moments about this point. If it were a moving point, a much more complicated relation would be required, but it is not; it is a point momentarily at rest and the proper equation of motion can be written by summing moments about this point.
If you pull on the string in an ungentle manner, such as to cause the Yo-Yo to slip on the surface, your best bet for writing the equations of motion is to the the sum of horizontal forces and the sum of moments about the center of mass (presumed to be at the center of the Yo-Yo). If you try to write a moment equation about the contact point, an incorrect result will follow (unless you are very sophisticated about it), because this is an accelerated point when slipping is involved.
When there is no slipping, the Yo-Yo has no option but to move in the direction of the applied force, the direction of the string pull. When there is slipping, then the Yo-Yo can rotate as well as translate, and the net motion can be in either direction, depending on the combined effects of rotation and translation.
This is a somewhat subtle problem, and you have to understand how to read the code in order to work the problem. In particular, you have to understand the implications of "A gentle horizontal pull". This sort of code has been embedded in mechanics textbooks for generations, and everyone who has done these problems for many years knows the code. Those who are new to the code just have to learn it; it is a part of the apprenticeship.