This is common in many interviews, not just "bug squash" interviews. I recommend having a plan for it if you're interviewing. Perhaps dedicate a virtual desktop to interviews if your system supports it.
Thanks for recommendation. I just finished my rounds of interviews, gotten a decent offer (SF company), being 20 years in industry. I have my own rules, and luckily they align very well with industry standards. So I never had any issues not following the scenario when I need to share something to land a job. I also don't do any take-home assessments, and moreover, I only use one programming language while interviewing. Never had any issues with that.
I think I don't need a plan or virtual desktop. I just say "no" if it doesn't work for me. Unless I am really desperate, I do not share.