Criticality of the $O(2)$ model with cubic anisotropies from nonperturbative renormalization