The so-called problem of unanswered prayer is a perennial issue in apologetics and pastoral theology, which is why I revisit this topic every so often. I've offered a number of explanations for why God doesn't always (or even regularly) answer prayer. Let's consider two more explanations:
i) If God always answered prayer, that would include answering prayers for things we can do on our own. But that would trivialize prayer.
ii) If God always answered prayer, or if there is just an overwhelming correlation, even if it wasn't invariable, the church would be flooded with people who were attracted to Christianity for the wrong reason. They's simply be motivated to get whatever they ask for. God as a bottled genie.
But that's not a proper motivation to be a Christian. No repentance. No heavenly-mindedness. If God answers prayer somewhat sparingly, that prunes away people like Simon Magus. That shakes off fair-weather believers.
I'm not suggesting that's a complete explanation for unanswered prayer. But there's probably no one explanation.