Now that we have dropped support for old PHP, we can remove this compatibility layer, which will simplify the code.
This PR supersedes https://github.com/protocolbuffers/protobuf/pull/13289. I had to move the PR to be based on a branch of this repo, since it modifies workflow files.
Closes#13325