Usually you first think about the performance wanted as speed, acceleration, hill climbing capabilities, range... then what is the bike frame you are going to use and where do you want to install the motor.
So the common is first thinking about the motor: wattage, size, hub or middrive, front/rear. For the frame wanted.
Common motor ratings are 250W, 350W, 500W, 750W, 1000W, 1500W and 3000W.
Choosing the motor first and then the controller is the natural step.
Then the controller must fit in wattage (the rating is peak power). So a 1000W motor should be with a 1000W controller and that make sure you can climb anything and the motor won't overheat in any condition / ambience heat. As dogman dan said the controller peak power can be around 3x the motor rating, and will work usually smooth, just with some care considerations about the heat generated on long hills or on hot days.
Using a less rating controller than motor just must make you think if maybe a smaller, lighter and cheaper motor fit better on your build.
The battery power rating, usually measured just as amperage "max continuous amps" and "peak amps" must fit with the controller continuous and peak amps too. If the controller can push 20A continuously and your battery only 15A, You just are wasting capabilities on your build. If the battery ratting is higher than your controller, just perfect! than means more efficiency, healthy battery over the time, and more cycles to use.
A battery "overloaded" by the controller is not a problem if there is a BMS, because the battery rating is limited by (under safe ratings if the BMS is correctly configured or choosen). But if you are using a battery without a BMS and you take more than it should from the controller, you can destroy the battery cells in a very few uses.