A phone cannot photograph its own screen, so take a screenshot of the QR code first.
Then start the eSIM setup — iPhone: Settings → Mobile Service → Add eSIM. Android: Settings → Network & internet → SIMs → Add eSIM — and when it asks you to scan, choose the screenshot from your photos. Both iOS and Android read a QR code out of a picture.
On an iPhone running iOS 17.4 or later the install button on the order page does the same thing with one tap and no screenshot.