Let E be a contractible space, and $X = E \coprod \{0\}$. Then there is a homotopy equivalence from $X$ to $\mathbb{Z}/2$ sending all of $E$ to $1$ and $0$ to $0$. The monoid structure on $\mathbb{Z}/2$ lifts to an $A_\infty$ structure on $X$. Suppose we could make this come from a topological monoid structure. By checking the induced monoid structure on $\pi_0$, we find that the unit for the monoid structure would have to be in the component of $0$, and hence would have to be equal to $0$. Then for any elements $e$ and $f$ in $E$, their product $ef$ is in the component of $0$ (and hence is $0$). Thus: any two elements in $E$ are both left and right inverse to each other. By the standard uniqueness trick for left-right inverses, this can only happen in the case where $E$ is a singleton.