Fix logic around marking services resolved or not

If you app->extend an object after it's been bound but before it's
been resolved, it will be initialized right away. The solution is
to just check if an object has actually been resolved rather than
if it's bound.

A related issue that can also be solved as a part of this is that
you can't extend deferred services. This has also been fixed.
Merge pull request #4648 from alprs/fix/extend-resolved-4.2

Fix premature instantiation of extended bindings and extending of deferred services
Fix spacing.
Small tweaks for methods that called often during application boot. For default Laravel application with 100 routes these tweaks eliminates hundreds of unnecessary calls. As a result execution time reduces significantly. I got more than 15% however independent measurement would be highly appreciated.