There are two questions here.
Regarding the second, it's a simple error of interpretation. Kant says that you cannot use others as mere means. This means you cannot treat rational beings as merely the means to your ends not that you cannot enter rational agreements where they become the means to your ends.
Regarding the first, Kant addresses questions of sex in the Metaphysics of Morals (not the Groundwork) that is more commonly read. There he addresses it twice -- once in the Metaphysical Principle of Right (a.k.a. Doctrine of Right) and the other time in Metaphysical Principle of Virtue (a.k.a. Doctrine of Virtue).
To make a long story short, Kant finds a way to legitimate heterosexual sex in marriage. The elements are that:
- He believes all sex is use of another person as means
- He believes only marriage can enable you to consent to this sort of use
as a contract for mutual use
- He recognizes the continuation of the species through procreation as an important way of keeping rationality in the world -- since we are rational creatures.
Through these three assumptions, he concludes that heterosexual marriage is okay if it procreative in intent.
Is this fully compatible with the first formulation of the categorical imperative that you quote? That's a good question. It seems incompatible on a first reading, but it's important to realize that the CI is a test of moral action and it's not clear that Kant prohibits action that is not immoral. So it could be that this falls into a dead zone.
You might also arguably be able to come up with a maxim that supports Kant's position and is universalizable. The challenge there is to define maxim of action, because there's very little clarity as to exactly what that is. Kant tells us it is a principle of will.