If that happens, i.e. a NATO country directly attacking Russia, then a nuclear war starts. I'd put China in the same basket, also Pakistan if it gets attacked by India or vice-versa. Proxy-wars (to use your example Poland attacking Belarus) are of course more complicated.
[1] https://www.telegraph.co.uk/world-news/2021/11/16/belarus-ar...
[2] https://www.itv.com/news/2021-11-12/russia-sends-paratrooper...
But Ukraine is right on the border of Poland. And what we saw in Ukraine is by the time Paris, London and Berlin notice something is amiss, Russia has already achieved their goals. And the fear-of-triggering-WW3 goes both ways.
I can believe Poland would want to be well equipped, so they can hold out for a few days so their allies have time to mobilise.
EDIT: I'm wrong about Afghanistan.
The US successfully invoked NATO article 5 after 9/11 requiring all NATO members to assist militarily.
Also, an attack of that nature would would certainly trigger Section 5 of the Collective Defense, and then US resupply. I suspect most NATO members who buy the very expensive F-35 do so in the belief (or hope) that the US will replace these aircraft immediately, from US squadrons, if necessary.
Read on if you are interested why it matters.
The US Army is a branch of the USA military. The US Army is not a costumer of the F-35. The F-35 is a joint project between the U.S. Air Force, Navy, and Marine Corps. That's 3 other branches.
Now one can say that this is a silly interjection and I should just see "US military" every time I see the word "US army" in the GP comment.
But, in the case when we are trying to understand the F-35 project understanding the crazy force structure of the US military is a must. Why? Because that structure left an indelible mark on the airplane!
Very roughly: The Air Force is the folks with the airplanes, the Navy is the one with the ships and the Marine Corps are the troops on the ship. But turns out in modern warfare you can't do naval warfare without having proper air cover, so the US Navy also got airplanes. And historically the marines were left in the lurch one too many times so they insist on having their own transportation, so they have ships, and also airplanes. (Very rough explanation, bear with me.)
You can see that the branches are somewhat converging, will we end up with 3 carbon copies of the same thing? The legislators asked the same question and put in the law limits on each branch. There are experts on what the particular limits are and etc etc, what matters to us in terms of F-35 that the Marine Corps can't have ships bigger than X. So they can't just buy a conventional aircraft carrier. Therefore the marine's airplanes have to take off vertically.
This means that when this 3 branches joined forces to build an airplane together the airplane had to be designed such that it can serve all 3 of them. So the F-35 has to have a variant which can take off vertically. And many says that capability made the whole thing waay too complicated and the boondoggle it is. And it's not a real physical "we need otherwise we cannot fight" thing. It's a legal loophole.
B2 I think is definitely thermal since it's inside/above the wing.
F-35 sounds like a good solution for, say, Poland, since Polish F-35 (Harpias) maneuvering unnoticed near Belorussian border will be able to attack Russian forces, supply lines all the way to the Smolensk Gate (50-mile-wide territory between the Dzwina and Dnieper rivers), which is a main attack direction for Russian army.
Similarly, planes operating in the middle of Poland can attack targets in Kaliningrad - another crucial strategic ability for Polish defense.
Note, that dogfight capabilities (in which F-35 is worst than F-16) does not matter here, Polish or Finnish army will always avoid confronting Russian air forces in the direct air strike, as they will be outnumber by Russians.
Strangely, it seems that F-35 is much more useful for other armies than US army so no surprise US army wants something different.
Another thing is that F-16 Viper has sensors almost at the level of F-35, can carry JASSM missiles, but it is way, way, cheaper to buy and maintain...