Fix passing stack_trace_class to constructor

Make the stack_trace attribute lazy and call it before BUILD.

Also call ->as_string on the stack trace so that the raw stack trace
gets filtered and the BUILD frame discarded, avoiding memory cycles on
the exception object.