Absolutely! Children are taken from parents who place their children at risk all the time and raised by living, caring relatives. We know 7 was loved by her aunt. Leave her there!
7 was also loved by her parents.
Many parents (dare I say most of them) who are in Starfleet, take their kids with them (this was evident on-screen).
It doesn't make it any less dangerous if you are with a group of people.
You are looking too much at this from the current day point of view and apply current day views to a society that eliminated a lot of cultural nonsense and notions that people hold today.
For example, a lot of people unnecessarily 'shield' their kids from realities of life (and more often than not, those kids often grow up unprepared for life).
The Hansens weren't morons or irresponsible... that might just be your projection onto the situation without properly understanding the context.
Trek humans obviously DO care and protect their kids... the Hansens were scientists who wanted to pursue their theories about the Borg.
Also, did it ever occur to you that even if they wanted to leave Annika with her aunt, they couldn't?
By the time they deviated from their flight plan and disregarded a direct order to return, as Annika's mother already said:
'We burned our bridges Magnus'.
The first bit of their scientific mission was in relative safety... but when the things turned more serious (probably due to a variety of circumstances), and the Hansens realized that, it was already too late to go back anyway.
Besides, they studied the Borg successfully by shadowing a cube for 3 years essentially undetected and unharmed.
But due to an accidental Ion storm, and Borg relentless adaptation, this eventually stopped.
Heck the Hansens had a better track record in protecting themselves and Annika for 3 years from the Borg. Which is more than I can say for some SF officers who came in contact with the Borg and lost how many crew members within hours or days of meeting them?
The Hansens were exobiologists according to Seven... I doubt such individuals did not exist on the Enterprise-D nor in Starfleet at large.
Though, the Hanses were also in a relatively 'small and nonthreatening' ship which might not have presented an enticing target for assimilation by the Borg (unlike the Enterprise-D).