We have a rule, if there is a tantrum when stopping to play a game the switch goes away for a few days and she's not had many of them since the first few. She even stops now when she starts feeling grumpy.
This is a pretty good rule. Having the game on the Switch also helps since literally, physically taking it away is much easier than, say, preventing access to a computer.