Fix #3649.

Here's how it's fixed. So, rather than doing the ``include`` first and then merge and  fix up the states, the states are now processed first so that ``__sls__``, ``__env__``, ``__extend__``, and ``__exclude__`` are added and different forms of state declarations are handled all before processing ``include``.