Topologically protected superconducting ratchet effect generated by spin-ice nanomagnets