I just tested this scenario in our SharePoint online tenant. Initially I had these versioning settings with 500 version limit.
I then created a new word document in library with 4 major versions:
Then I changed versioning settings to limit the number of versions to 2:
After changing versioning limit, I checked the version history of the document and it was still having 4 major versions. Changing major version limit did not delete the older versions of the document.
Then I opened the same document, edited it to create a new version. After edit, it removed all older versions and kept latest 3 major versions (one current version and 2 older versions maybe). Here is the updated version history:
Conclusion: I think as per the link you provided in above comments and this article,
Until we create a new document or edit the existing document, those versioning limits will not be applicable. The new limit will not affect the existing old versions. We need to Delete them explicitly.
You can follow 2nd link to delete the older versions by using PowerShell - You can either delete older versions or simply update the document properties (like Title column or any other column in library) to force the new versioning limit.