The money associated with gift cards always end up at Apple.
Gift cards can't be used to transfer cash to others, via Apple Pay or otherwise.
I would not expect an Apple Gift Card to be applied to Apple Pay, and would expect it would be added to the Apple ID balance.
Per Apple: "Apple Gift Cards are solely for the purchase of goods and services from the Apple Store, the Apple Store app, apple.com, the App Store, iTunes, Apple Music, Apple TV, Apple Books, and other Apple properties."
The money associated with Apple Pay can go elsewhere, so I would not expect an Apple Gift Card to be redeemable there.
Confusingly named, the so-called Apple Gift Cards can be used for most purchases from Apple. There have been other gift cards offered by Apple, and those gift cards can have restrictions about what can be purchased: What type of gift card do I have? - Apple Support
Put differently, check where the cash is. It might be (probably is?) associated with the Apple ID. Not Apple Pay.