Would it be legal to quit the job for a few days, quickly roll the 401K over into an IRA, then get rehired (which I could do and I know I would be rehired), and cash out of the IRA?
you still will pay the taxes...the IRA will send you a 1099 and report your grab to the govt
You do not have to quit to do that. Just tell them that you have decided that you want a different custodian, and are withdrawing all your money to do a rollover in 60 days.
Or you can do a direct rollover, but in a lot of companies it is faster to do a withdrawal or loan. Talk to your human resources department if you have one, or your IRA custodian about whatever rules they have.
Also consider vesting. If you are not vested, you may only get some of your company match. But your contributions and earnings on that money is yours and can be demanded at any time. They have no right to keep it (at least not yet).
“Would it be legal to quit the job for a few days, quickly roll the 401K over into an IRA, then get rehired (which I could do and I know I would be rehired), and cash out of the IRA?”
IIRC, there’s an additional 10% penalty for withdrawing money from an IRA in the first two years of it’s existence.