If you know the current draw of the motor , it might be simpler to in-line a resistor with the motor and skip the IC... (like a 20 ohm resistor if your motor draws 200 mAmp)
FYI from the 7805 spec page ( you might want to read it over)
https://electronicsforu.com/resources/learn-electronics/7805-ic-voltage-regulator
The greater the difference between the input and output voltage, more the heat generated. If the regulator does not have a heat sink to dissipate this heat, it can get destroyed and malfunction. Hence, it is advisable to limit the voltage to a maximum of 2-3 volts above the output voltage. So, we now have 2 options. Either design your circuit so that the input voltage going into the regulator is limited to 2-3 volts above the output regulated voltage or place an appropriate heatsink, that can efficiently dissipate heat.