Rewrite docs for context locals, request contexts, and app contexts

Closes #1151.

The following is an incomplete draft. However, I wanted to request comments immediately, in case anything was severely wrong.

The doc should be updated to include:

- [x] How context-local objects in Flask are implemented

Will squash commits later.
It's harder to reason about code when it contains global variables. This is not just about leaking state, but you'd have to learn the specifics of a framework when reading Flask code. Library code is easier to understand.