implement list_insert_in_workspace in plain CMake without python

This speeds up the CMake run from 12s to 8s on a workspace with ~50
packages.