Major type safety improvements in Query

- Moves more code from c.Tree to c.Expr[R]
- Adds small `core` singleton object with trusted utilities that
  should ideally go into scala.reflect eventually