Sure, but if you’re a tourist in e.g. Barcelona trying to get a prepaid SIM, odds are the shopkeeper will not ask you for your ID despite being required to.
> Last I traveled the shop required a passport or uploading one to get an eSIM ahead of time.
Sounds like you went to a carrier boutique and not one of the million independent shops.
I would think most tourists would trust a carrier-branded store over Honest Jochen's Tobacco Emporium where you may or may not get a working SIM after paying cash.