This is a dichotomy of a discrete variable (the finite "number" of field lines) and a continuous variable (the B field smoothly changing values over all of space). While your question is specifically directed to magnetism, the intuition for the relationship between B-field strength and counting field lines might be more visible if we abstract the problem.
Consider a platform Like (1), with masses evenly distributed each exerting a downward force on the platform. If we wanted to find the "force density" between a point A and B on the platform, we would add the force vectors (the downward arrows, analogous to the discrete field lines) and divide them by the distance between A and B (some multiple of L)
Now consider (2), where there are twice as many masses per unit length, each with half the mass of (1). Obviously the sum of the force vectors over a length between A and B will be identical to (1), even though there are a different number of "field lines".
In (3) we have a blanket laying over the platform. Unlike (1) and (2), where we have a discrete set of force vectors running along the platform some distance apart, the downward force of the blanket is distributed continuously over the platform. This means that we can't count the force vectors individually, as there are infinitely many of them and their magnitudes are infinitely small.
However, if you wanted to approximate (3) without having to use calculus, you could model it as (1) or (2), so long as $dF/dL$ was equal to the Force/Length measurement of the discrete model.
The B-field is very much like (3), defined as a specific point by taking the infinitesimal change in (Force per Current) over an infinitesimal distance, and can be approximated by taking some finite change in (Force per Current) over some finite distance, which can be viewed as a field line.
If you have taken calculus, this is the same property that allows an integral of a function to be approximated by the Riemann sum over the function.