In theory it should be possible for a package manager to check the public API for obvious breaking changes and throw an error if the major version has not changed.
Its been done as a research project [1] but I don't think it has been done in any major language or package manager.
[1] https://drops.dagstuhl.de/opus/volltexte/2018/8456/pdf/OASIc...