Pandu replied, 'O handsome one, strive duly this very day to gratify our wishes. Fortunate one, summon thou the god of justice. He is the most virtuous of the celestials. The god of justice and virtue will never be able to pollute us with sin. The world also, O beautiful princess, will then think that what we do can never be unholy. The son also that we shall obtain from him shall in virtue be certainly the foremost among the Kurus. Begotten by the god of justice and morality, he would never set his heart upon anything that is sinful or unholy. Therefore, O thou of sweet smiles, steadily keeping virtue before thy eyes, and duly observing holy vows, summon thou the god of justice and virtue by the help of thy solicitations and incantations.'
https://www.sacred-texts.com/hin/m01/m01123.htm
Pandu requested Kunti to get an offspring from Yama so that a virtuous person can be born in the lineage of the Kurus which is not wrong.
As for Kunti getting Karna from Surya, she did it to test the boon given by Durvasa.
Once she gratified by her attentions the terrible Brahmana of rigid vows, who was known by the name of Durvasa and was well-acquainted with the hidden truths of morality. Gratified with her respectful attentions, the sage, anticipating by his spiritual power the future (season of) distress (consequent upon the curse to be pronounced upon Pandu for his unrighteous act of slaying a deer while serving its mate) imparted to her a formula of invocation for summoning any of the celestials she liked to give her children. And the Rishi said, 'Those celestials that thou shall summon by this Mantra shall certainly approach thee and give thee children.' 'Thus addressed by the Brahmana, the amiable Kunti (Pritha) became curious, and in her maidenhood summoned the god Arka (Sun). And as soon as he pronounced the Mantra, she beheld that effulgent deity--that beholder of everything in the world--approaching her. And beholding that extraordinary sight, the maiden of faultless features was overcome with surprise. But the god Vivaswat (Sun) approaching her, said, 'Here I am, O black-eyed girl! Tell me what I am to do for thee.' "Hearing this, Kunti said, 'O slayer of foes, a certain Brahamana gave me this formula of invocation as a boon, and, O lord, I have summoned thee only to test its efficacy. For this offence I bow to thee. A woman, whatever be her offence, always deserveth pardon.' Surya (Sun) replied, 'I know that Durvasa hath granted this boon. But cast off thy fears, timid maiden, and grant me thy embraces. Amiable one, my approach cannot be futile; it must bear fruit. Thou hast summoned me, and if it be for nothing, it shall certainly be regarded as thy transgression.'
So Kunti did it out of curiosity. In my opinion, Kunti should not have done that but Karna and Yudhisthira are not uncle and nephews. Pandavas and Karna are spiritual sons of gods. They are like gods on earth but at the same time, Pandavas were biological sons of Pandu.
Pandu wanted a virtuous son in the line of Kurus whereas Karna was born for a divine purpose. Narada told to Yudhisthira about Karna.
This, O sinless one, that I am about to tell thee is unknown to the very gods. Listen to me, O mighty-armed one, as it befell in former days. How all the Kshatriyas, cleansed by weapons should attain to regions of bliss, was the question. For this, a child was conceived by Kunti in her maidenhood, capable of provoking a general war.
Bhishma, Ashwathama, Karna, Pandavas and Krishna were portions of gods born for a divine purpose which was to slay demons born in world of men such as Duryodhana, his 99 brothers, Jarasandha and others.
Karna was born to provoke a war in which demons born on men could be in the battlefield and get slain to relieve earth from her burden.
Kunti should have known that Durvasa was a powerful sage and his boons and curses have a true meaning but there was nothing wrong in having child of Surya and Yama. Karna was born for provoking a war as ordained by gods, Pandu wanted a virtuous son so Kunti called Yama and had Yudhisthira, Pandu wanted a strong kid so she called Vayu and had Bhima, and Pandu wanted a famous and incredible warrior invincible in battle so Kunti called Indra and had Arjuna. Madri called on Asvins for beautiful kids and has Nakula and Sahadeva.
There is nothing wrong. Kunti and Madri called gods for children based on the characteristics such as virtuous, being strong, etc.