I suggest that you take a look as something like one of these:
https://www.amazon.com/Arrival-Elect.../dp/B0736T5RFG
https://www.amazon.com/Electric-Moun.../dp/B01N1VR6ND
https://www.amazon.com/Electric-Moun.../dp/B075SYVWW2
And then change the sprocket to only provide assist up to say 10 mph. The motor has a freewheel on it, so no problem over speeding the motor, or shutting it off entirely. The motor will provide no assist above its maximum revs. The above motors at the output of the gearbox run about 300 rpm at the rated voltage; they have a 12T sprocket. To get ~10 mph, that would be matched with a 30T sprocket on the rear wheel. This would give you a good amount of hill assist, and absolutely no top speed assist.
Motors do not like to be heavily loaded at less than about half their maximum speed. Hill assist is almost always by definition less than that. Many direct drive hub motors have a noticeable amount of drag when not powered.