Is stalling a DC Motor with rated current safe for the motor?
It depends but it should be okay. The main failure mode in the motor is due to the resistive heating of the windings when current is flowing through them. Since the resistance does not change with speed, the heat generated will be the same whether stalled at rated current or at full speed with rated current.

One issue to consider is that in most DC motors only two coils are energised at any point in the cycle (the six step pattern for 3-phase motors). If the motor is rotating this means that each coil only operates at a 66% duty cycle. When stalled two coils will conduct 100% of the time so the heat generated will not be spread evenly around the rotor. This will also apply to the current flowing through the brushes. Depending on the motor design it may be worth derating the current because of this.

Also note that if the motor relies on forced cooling you will clearly have to derate the current due to the loss of airflow.

Regarding the gear this will not have any issues. The torque output from the motor is directly proportional to the current and since you are limiting this to rated, the gear will be fine provided it is designed for the rated torque of the motor.