I'm going to chime in here and point out that from the government's perspective, they only really "check" your Roth contributions and withdrawals once a year when you file taxes. You are allowed to temporarily withdraw funds, and as long as you put them back before you next file taxes, the government doesn't care.
This is clever (but potentially risky) way to "borrow" from yourself if you get in a crisis. Unlike borrowing from a 401k, you don't owe the balance when you leave your job. And unlike 0% credit cards, you are only risking missed gains and dividends, but not fees and interest.