Which ROS2 component is responsible for managing packages?

The ROS2 component responsible for managing packages is called ament_index. ament is a build system and package manager for ROS2.

You can find the ament_index git repository at https://github.com/ament/ament_index