Almost analytic extensions of ultradifferentiable functions with applications to microlocal analysis