It's not that you should never have expectations. It's that you don't have expectations of people until you know them well enough to know what to expect. If someone is flaky... then don't expect them to be reliable. But that doesn't mean that you can never spend time together, or that they can't be a positive part of your life, you just never structure your plans so that your time will be a loss if they bail on you. If someone is flaky, it's not "Let's have lunch tomorrow" it's "Other friend and I are having lunch, you're welcome to join." If you do the first, you may be sitting around at the restaurant feeling like a loser because you've been let down again, if you do the second you still get a decent time out of it. If you don't have anyone who will be the back up, then you have to choose activities that you are equally comfortable doing alone.
A dinner party can be intimidating for people, or require a lot of energy to socialize. If they had a rough day on top of being flaky, maybe it was too much to handle for them. If you start out with smaller things that are low key, you risk less disappointment and make it easier for them to hang out. Then you can get to know how you can depend on. But you don't let it get you down when they bail on you, because they will sometimes or even most of the time.
As someone proves themself to be reliable, or trustworthy, or a good listener, or whatever you value in a close friend, you can build expectations about them, but you don't start relying on them before they have shown that they are reliable.