Are there any nations that will allow anyone to become a citizen if you join the military

I know in the US you can obtain citizenship faster if you join the military. What I’m wondering is are there any nations on earth where anyone from any nation can move there, join the military and obtain citizenship that way? Like can anyone on earth (who is fit and young enough to join the military) go to a nation like Poland (just to pick one at random), join the military and obtain citizenship that way?

I’m too old and unhealthy to join the military, I’m just curious if that is a system anywhere.

What about during an active war? Like during WW2 did any nations basically open up their immigration status to anyone who wanted to join? I know nations offer various incentives to join the military during wartime, but they also sometimes retract those offers.

I think in the revolutionary war, Britain offered freedom to any US slave who fought for the British. In WW2, the USSR offered freedom to any prisoner who fought for them (then just sent them back to prison after the war anyway).

During major conflicts did any nations say ‘anyone on earth can obtain citizenship in our nation if you serve X years in the military here’.

French Foreign Legionnaires are rewarded with citizenship if wounded, or may apply for citizenship after 3 of their 5 year enlistment.

It appears to be the case in the UK (though - surprise, surprise - the powers-that-be can contrive to make a bureaucratic balls-up of the process).

Of course, it isn’t an easy route to citizenship - the armed forces don’t take just anybody.