The two answers with the most upvotes work like a charm.
In case somebody else is banging his head why it does not apply the patches, you might want to install the composer package that actually applies the patches.
composer require cweagans/composer-patches
After this composer will apply the patches
More information can be found here: https://experienceleague.adobe.com/docs/commerce-operations/upgrade-guide/patches/apply.html?lang=en#composer