They didn’t, Google are the first to do three years of OS updates and security patches with the Pixel 2 and extended that to the first gen Pixel. Samsung were doing two OS updates until they promised they would do 3 OS updates at the Note20 launch and extended it to the S10 and other models. You are correct that they upgraded that to four with the S21 before Google made the jump from 3 to 7.
And will still have that awful GN3 sensor on the primary rear camera. Xiaomi were using a Sony sensor of the same size on the Redmi Note 12 Pro a phone that cost somewhere around $200-300 depending on the region it was sold back in 2022 and 2023.