It’s not speed so much as torque. Class 3 ebikes ate already pushing the limit. You have to be careful with part selection, and tolerances on derailier adjustment is tighter.
And brakes. Then it is a matter of speed. You just need bigger parts to take more heat so you don’t get brake fade. It’s why anything more than a class 3 needs scooter/motorcycle parts. If they don’t, run away.