The early evolution of young massive clusters: II. The kinematic history of NGC 6618/M 17