Bolesław III., Polen, Herzog