The problem with pledging allegiance to a State is that a body politic in and of itself cannot accept or take allegiance.
Allegiance is given to the natural person of a human being, typically a king.
In essence however, you are correct.
The United States is not a country. It is a society of States. One's State is their country and where "allegiance" should lie.
Myself personally, I'd avoid pledging in any and all forms at all costs.
Redemption of the pledge for breach of agreement can be most painful .