raccoondad If I am not mistaken, the hardware also prevents a downgrade of the Android version.
So if you are on 12, upgrade to 13, you are now forever on 13 or higher.
I remember this was a big problem when 13 came out if memory serves me correctly.
My understanding is that the situation you describe was a one-off specific to the Pixel 6 series, and that it wasn't really about the Android version.
My understanding is that Android 13 for the Pixel 6 series required a bootloader upgrade, and that the old bootloader had a security vulnerability. So flashing Android 13 would upgrade the bootloader and permanently mark the phone as requiring the new bootloader. At that point it was not possible to reinstall the old bootloader, which was part of the typical install process for Android 12.
Here is a source: https://9to5google.com/2022/08/16/pixel-6-android-13/
This article indicates it was possible to downgrade from 13 to 12 for everything that wasn't a 6-series: https://9to5google.com/2022/12/16/how-to-downgrade-from-android-13-to-android-12-on-google-pixel/
All in all, I don't think there is a one-way hardware counter storing the Android version.