My answer leans towards that of Jan Lalinsky. It is not really clear what is the historical status of force with respect to the mass $m$ of an object in the second law. Some say it is tautological and others that is contingent.
Fortunately, we don't need to answer that question here to gain insights into what Newton may have had in mind when talking about masses.
First of all, we need to first acknowledge that Newton put a great deal of effort to make his 3 fundamental axioms (now called Newtons' laws) consistent and closed.
It is also important to appreciate, as I will try to show, that Newton's synthesis was compiling insights from both dynamical observations (from Galileo and Descartes for instance) and static ones that had in fact been going on for ages just for the purpose of trade of goods, architecture etc...
If you read the second law from the english translation of his Principia it basically says that:
Law 2: The alteration of motion is ever proportional to the motive
force impressed; and is made in the direction of the right line in
which that force is impressed
i.e. in an inertial frame of reference (only frame in which the notion of "motive force impressed" makes sense according to Newton) we have $a \propto F$. Of course, at that stage neither $F$ nor the proportionality factor are known; but if either comes to be known then the other follows.
I think nothing in the 3 laws of Newton's really forces the proportionality factor to be exactly the mass as we know it. In fact, as Jan Lalinsky stated, we just need to name the prefactor "inertial mass" $m_I$ and the combination of Newton's 3 laws will give that the state of motion of the center of (inertial) mass of any system of points in absence of external forces is following a straight line motion at constant speed (which is equivalent to the conservation of total linear momentum...and this is true regardless of the distances between the points in the system).
Such a proposition had already been made by Descartes for instance but he had postulated that the inertial mass would correspond to the volume of the body on the basis that the laws of Nature ought to be explainable with space and time only. This turned out to be incorrect and a new fundamental concept had to enter the arena.
To see this, we can simply acknowledge that Earth is pulling on a object via a downward motive force called weight and with symbol $W$.
Assuming the terrestrial frame is inertial, we can infer that $m_I a = W$.
Now, we can apply, as Newton did, Galileo's observation that
Provided air friction can be neglected, all bodies observed from a terrestrial frame $T$ fall with the same constant acceleration of
magnitude $g$ towards the ground
The only possible conclusion is that $W = m_I g$, where $g$ is the same for all bodies.
There is therefore a direct relationship between the weight of an object and its inertial mass. This enables one to measure relative masses via statics experiments by invoking Newton's 2nd law and this is still how masses are measured today.
To me it seems impossible to talk about masses, in the Newtonian context, without invoking statics and gravity. One can do it as I did above by relying on the practical observation from Galileo or by postulating an additional universal law; which is what Newton did with his Universal law of gravity.
This is important because the grand Newton's synthesis makes sense, in practice, only when his three laws are combined with his universal law of gravity. In fact, he tentatively tried to show that if the gravitational mass of an object was not proportional to its inertial mass, then self consistency of his theory would be lost.