Mid Drives normally use speed plus cadence (pedal rpm) to determine what gear you are in so that power at the wheel can be stable.
My rear hub drive Bafang kit seems to change the controller power based on pedal assist level setting 1-5 as pedaling slower or faster does not seem to affect the power. There is no speed sensor visible not probably required as motor rpm will match speed directly.