Is having a son required for achieving moksha (liberation)?

There are two things to address. Moksha means liberation from the material world. We want something higher than that. We want loving service to Krishna in the spiritual world. To achieve that, we need to develop love for Krishna. We do this by serving Him, remembering Him, and offering everything we do to Him. There is no mention of having a son.

There are certain desirable things in the material sphere, and having a son may be one of them. However, there are no material requirements for attaining love of God and going back to Him. The only requirement is loving service to His lotus feet.

I would suggest that you read the story of King Chitraketu from the Srimad-Bhagavatam 6th canto chapters 14-16. You will find it very enlightening.

Hare Krishna
Sincerely
Laxmimoni dasi