That'd depend on the implementation behavior. If it's using window.onbeforeunload, yeah I guess it's kind of like someone blocking you when you try to leave, although you can easily walk around them (on most browsers if you try to close the tab and the modal shows up, and you try to close the tab again it will override the modal). However, there's also another type where it tracks the location of your cursor, and shows a popup when it leaves the content area (indicating that your mouse is going to close the tab or go back). In that case it's not really blocking anything, and much more analogous to a salesperson saying "before you go" as you're walking out the door.
Which is a solid ‘no thanks, not coming here again’ from me.
I would try to avoid going back to that store.
It’s annoying and tacky but it’s not analogous to being held hostage.
Many stores do indeed make it hard to leave without buying, for example by having no direct route to the exit: you have to squeeze through the tills awkwardly. It's probably in the name of loss prevention, but it's also a disincentive to leave without a purchase.
Actually, nearly everything about a supermarket is carefully designed for extracting money from you, from product placement, to layout, need to have a loyalty card to access discounts, even perhaps having discounts in the first place (as opposed to selling at a lower regular price), multipacks driving food and packaging waste, etc etc etc.
That's insane behavior, I don't owe your business or site anything, least of all my time. Those are the kindest words I can find for that behavior.