This sounds like a Sim Pin Security Protocol.
This is usually found within the security protocols within the phones settings.
Current Phone > Samsung Z Fold³ 5G.
Thanks for suggestion. I've hunted all the settings but couldn't find any reference. It also asks for phone PIN, not SIM PIN, though. And often it's when the PIN input keyboard is hidden under the ordinary keyboard and can't be accessed. Only had this since the Marshmallow upgrade...