Seems somewhat unethical IMO (admittedly I'm not sure I can fully justify this feeling), and most good software engineers are paid enough to be able to be fairly ethical, but yes.
I don't have a firm answer to this, it's more of a feeling that "this is wrong", but here are some possible arguments. I'm not sure they are the best possible arguments, but they're a quick first pass at making the argument.
It is good for society as a whole if people release their work publicly/open source. People will only release their work publicly/open source if it doesn't substantially hurt their potential earnings. So it's best to avoid taking advantage of publicly released work in ways that hurts their earnings (all else being equal).
Profit should go to the person who did the work making something. In this case gitlab did the work, and the person adding ldap here is almost entirely freeloading off of their work to make a profit. That isn't fair - especially when the freeloader has a direct negative impact on gitlab's earnings.
The person adding ldap support is not doing useful work for society, rather they are just doing busy work to redirect a stream of money towards them, that's not good.
And to add to all of these - the person doing this work is a competent engineer. They have lots of other ways to make money that are perfectly ethical, they do not need to resort to this.
I guess something about competing with a group of people by using code that they almost exclusively developed feels wrong... but I'm not certain enough on this position to really argue it on the internet.