I applied your patch. I ran extended application tests relative to vanilla ones, which include various scenarios of working with LDAP and I think that we can safely apply the patch in the PG18.
I did not see the need for additional LDAP tests, since compatibility is provided by the LDAP library itself, and not by the Postgres code. Also protocol version 3 has been published for quite a long time (more than 20 years) and real use by clients is through version 3