You are right that insurance in the US is regulated by each state. It is also true that some insurance companies don't sell policies in all states. You frequently see this with property insurance where fires and hurricanes can make it too expensive for a company and they decide to stop selling policies in an area.
Since you know that you will be moving, it would be easy to check if currently the companies you are considering offer policies in both states. I think that the nationally known companies do operate in all states, but you should check.
It is likely that If you move to another state and you are using a national company the insurance company will transfer your policies to another branch office in the new state. With life insurance unless you need to change the duration or the amount of the policy there generally is no need to even talk to an agent after the policy is put in place.
Homeowners and car insurance are linked to where you live. The zip code can make a big difference in the cost and coverage available.
I do know that If you move is out of the United States your life insurance coverage will change and it can depend on what country you are moving to.
So I'm a little concerned that if I buy the life insurance policy now,
it'll cover me for a year, but then won't do anything for me for the
other 20 years I have it, and that I'll still be on the hook for 19
years of payments.
With life insurance you can cancel it at any time, so even if you move to that one state where they can't insure you, the term of the policy isn't locked in. You find insurance with a new company and cancel the old policy. You should also get a refund for the partial year.
The risk in that case is that with a X year term policy with level premiums, by design you overpay in the early years to underpay in the final years. So If you know that you will be moving in a year or two, and you know they don't offer a policy in the new state, then you might consider a shorter term only 5 or 10 years instead of 20 years.