$X(3872)$ production in high energy heavy ion collisions