Hi,
If you do ~/rtabmap/bin/rtabmap --version, does it show:
With Freenect2: true
too ?
If CMake tells that "With Freenect2 = YES", then --version above should show yes too and the freenect2 driver should be enabled.
Note that sometimes not the right rtabmap is started when launching just with "rtabmap", the melodic binaries are taken instead. You can make sure that binaries are uninstalled:
sudo apt remove ros-melodic-rtabmap
Other issue is that the right "rtabmap" is taken, but the the right librtabmap_core.so is loading on runtime. You can do "ldd ~/rtabmap/bin/rtabmap" to make sure it uses the right library.
cheers,
Mathieu