Actually, the timing on that layoff is super suspicious but legally they can't fire you just for taking a counteroffer. They'd need another documented reason, otherwise it's retaliation. Might have been a planned layoff they just rolled you into. Still a trash move by them.
My old manager in Austin used to say a counteroffer is just a company buying time to find your cheaper replacement. They gave me a 15% raise to stay, then outsourced my entire team to contractors two months later. Felt like they paid me extra just to train my own replacements. Classic move, honestly.