"Illegal" under what jurisdiction?
> They must allow you to inter.
That's evidently not true. Or at least grossly misleading. Countries can and are refusing to allow all people who want to get onto flights bound for the country they're citizens of.
My country (.au) is currently limiting inbound international travellers to 3000 per week, with over 40,000 Australian citizens registered as trying to get home. Some of those people have been trying for close to 12 months to get home.
These restrictions mean that airline seat pricing is going insane. In pre Covid times, I'd regularly fly Sydney to SF round trip for $AUD1500-$2000 or so on United. A recent news report says they're now flying business/first class only flights with the cheapest one way LA-SYD tickets being $AUD21,000.
Can you imagine being on a trip last Jan/Feb with a return ticket for March or April, only to be told your return ticket keeps getting bumped for higher paying customers but you could always upgrade to a $21,000 ticket to get home. And your travel insurance says "Sucks to be you, you're not covered for pandemics, as outlined in section 374 on page 93 of your Product Disclosure Document you got when you paid your premium. Have a nice day!" So now you're stuck in the US, originally of a 90 day tourist visa waiver and not legally able to work, and there's no casual work available anyway because of Covid shutdowns, and you've needed to manage to find food/shelter for 12 months while waiting for a flight home. I know one of those people, and know of several more...