The entire ROS ecosystem is made up of CMake C++ (and Python) packages. These CMake packages are simply C++ libraries compiled via CMake. It sounds like what the question is asking for is can they create a CMake C++ library that does not depend on ros.h
or rclcpp.hpp
or a library that depends on these dependencies. This means that the message files must also not be used. I suggest going to the git repository (usually github hosts them) for the the ROS package and look for where there are references to ROS. Simply re-write the functions that use ROS messages and ROS transport mechanisms so that you don't need to use ROS.
Honestly, though, it is probably better if you learn to build ROS2 from source so that you learn from experience how all of these packages depend on each other, even if you don't need ROS. Why the hard requirement to not use ROS? ROS is simply a data transport layer that is tailored to the robotics hardware ecosystem. MoveIt has many dependencies and separating ROS from the libraries would not get you closer to solving your problem. I suggest creating a Dockerfile to build ROS2 from source starting from a Ubuntu 20.04 docker image.
Prereq: Install ROS
. $\endgroup$