This is follow-on work for SERVER-39695.
Compiling a regex can be O(2^n) time (n being size of the regex). In most cases, users will probably run the same regex over and over. Recompiling the same regex over and over would be extremely silly, and in some cases may make the $regex operator completely useless.