Constructing subgroups of semidirect products via generalized derivations