Given the unexplanatory tone of many number theory expositions, it is, in fact, reasonable to ask this question, I think... insofar as there is a good explanation, apart from the artifactual one.
That is, the Riemann Explicit Formula, as reformulated a bit by von Mangoldt, is an exact (not merely asymptotic) equality of a sum over primes and a sum over zeros of the zeta function. The sum over primes, at best, is not quite just $\sum_p 1$, but, perhaps most simply and most naturally, a sum of $\log p$ over prime powers $p^m$. That is, the "left-hand side" is $\sum_{m,p:p^m<T}\log p$. That is, one side is a sum over prime powers under a given bound, and the weight of the counting is $\log p$. This is an immediate and transparent artifact of the complex analysis the extracts the equality. No imagination required ... beyond the profound insight to do the thing at all... :)
The understandable confusion arises from both unexplanatory sequels that presume one knows the context, as well as from knock-off derivative work that takes whatever is found in books and papers and unthinkingly fools around with it.
Thus, the short answer is that there are compelling reasons for the appearance of this weighting scheme. Sure, it is not what the most-naive/ideal program would ask for, but it is somehow the perfectly correct answer. The more naive question of "counting primes" is somehow incorrectly posed... in the sense that one must go from the clear (with RH or not...) statement of the explicit formula to messier assertions about the naive-but-awkward formulation.
Sure, we could say that the more-sophisticated answer dodges the original question. Or, we could say that the original question was in some sense doomed, because it could not admit as simple an answer as we hoped, while the more-complicated question allowed a good answer.
I looked at the overcount for the case $a = 7, b = 49$ and it turns out that $H(a,b,15)$ doesn't count odd pairs $(25,27)$ nor $(33,35)$ which explains why the count is off by two when I run the up-to-date code.
The reason is because:
$$
(x^2 = 1 \pmod 3) \wedge (x^2 = 1 \pmod 5) \iff \\
(x = \pm 1 \pmod 3) \wedge(x = \pm 1 \pmod 5) \iff \\
(x^2 = 1 \pmod {15}) \\ \vee (x = -1 \pmod {3} \wedge x = 1 \pmod {5}) \\\vee (x = 1 \pmod {3} \wedge x = -1 \pmod {5})
$$
$H(a,b,15)$ only counts the first part, the parts where $x = -1 \pmod {3}$ and $x = 1 \pmod {5}$ or vise versa (swapping $3, 5$) are not counted and those are precisely the pairs $(25,27)$ and $(33,35)$.
The good news is that those $\vee$'s are exclusive or's so once we come up with a formula for the rest we can add/subtract it in. The bad news is I'm not sure how to count those, for general $q_1\cdots q_n$. It might be easier, knowing each $q_i$ is distinct.
Best Answer
$\sum_{n \le x} \lambda(n)\lfloor \frac{x}{n}\rfloor = \sum_{n \le x} \lambda(n)\sum_{m \le x/n} 1 = \sum_{n \le x} \lambda(n)\sum_{nm \le x} 1 = \sum_{n \le x} \lambda(n)\sum_{n | d \le x} 1 = \sum_{d \le x} \sum_{n | d} \lambda(n) = \sum_{d \le x} 1_{d \text{ square}} = \lfloor \sqrt{x} \rfloor$.