Let $A(x) = \sum_{n\leq x} a(n)$,
where $a(n) = \frac{1}{k}$ if $n=p^k,$ p prime and is $0$ otherwise.
i believe that its possible to show that $A(x) = π(x) + O(\sqrt x \log(\log(x))$ is it possible to show that the better bound $A(x) = π(x) + O(\sqrt x)$ also holds?
(the answer may well be no)
The function $A(x)$ is often denoted by $\Pi(x)$, and called the Riemann Pi function. In particular, $$A(x)=\Pi(x)=\sum_{n\leq x} \frac{\Lambda(n)}{\log n}$$ where $\Lambda(n)$ is the Von Mangoldt Lambda function. By splitting up the sum based on the value of the exponent, we have that $$\Pi(x)=\pi(x)+\frac{\pi(\sqrt{x})}{2}+\frac{\pi(\sqrt[3]{x})}{3}+\cdots=\sum_{j=1}^{\infty}\frac{\pi(\sqrt[j]{x})}{j}.$$ Using this identity, you can prove your desired result. (Or even something slightly stronger, with an additional $\log x$ in the denominator).