Matt 18:19, 20 cannot and should not be divorced from the previous verses because V18 begins with the word, Πάλιν (Palin) = "Again". So let me quote the context:
V18 is essential to understand the the explicit connection with V19. V 18 says (NASB):
Truly I say to you, whatever you bind on earth shall have been bound
in heaven; and whatever you loose on earth shall have been loosed in
Allow me to quote from J B Phillips (The New Testament in Modern English, Collins) on this important Greek construction:
Matthew 16:19 and 18:18, "forbidding" and "permitting". There is a
very curious Greek construction here, viz, a simple future followed by
the perfect participle passive. If Jesus had meant to say quite
simply, Whatever you forbid on earth will be forbidden in Heaven", can
anyone explain why the simple future passive is not used? It seems to
me that if the words of Jesus are accurately reported here, and I have
no reason to doubt it, then the force of these sayings is that Jesus’
true disciples will be so led by the Spirit that they will be
following the heavenly pattern. In other words what they “forbid” or
“permit” on earth will be consonant with the Divine rules.
Thus, and this is the nub of the issue, Christ's followers will act in accordance with the will of heaven (not the other way around). This is what it means to "gather in my [Christ's] name" (Matt 18:20) - to act in accordance with Christ's/heaven's will. we know this is the intent of Jesus comment because He further says, that "For where two or three gather together as my followers, I am there among them." (Matt 18:20) Again, people are acting, and requesting things, according to the will of God.
Under such circumstances, where people act according to the will of God, and Christ is in their midst, of course God will respond positively by granting the request - God always acts in accordance with His own will.