I received a call one time with a SOB story about someone locked out of their yahoo email account with my phone number, which I've had for over a decade. In the back I could hear people talking, person had a thick accent from a country known to scam people. I knew it was a scam so I started probing more and they finally hung up.
It is a super bad idea for anyone to give out 2FA codes, they could easily found your email associated with a specific number from a security leak and attempt to steal it.