Natasha sacrificed herself in Endgame, this unusual framing allowed for the MCU movie to retroactively explain some of the biggest mysteries surrounding Natasha in a way that couldn't have otherwise be done. This move also let some of Romanoff's personal motivations become a little clearer - something that arguably needed to be done given how relatively little time the hero was given character development-wise throughout her entire time in the Marvel Cinematic Universe.
When watching Endgame without the context of Black Widow, Natasha's decision to sacrifice herself in order for the Avengers to obtain the Soul Stone seems somewhat simple. Aware she is one of the few Avengers who can state that the team is their only family - and aware the decision is between her and Clint Barton, whose children and wife she is seemingly fond of - h received a mixed response from viewers upon release.
Upon watching Black Widow, Natasha Romanoff's motivations for her sacrifice become much more complex - and lose their original tragic implications, even if they do also gain new ones. It's clear from Black Widow that Natasha still considers Yelena, Melina, and Red Guardian Alexei her family, even if she initially does so begrudgingly. It's also clear she considers the rest of the Red Room in some way her family, as her efforts to rescue them all show how strong her bond from shared suffering is with them. With this other family in mind, it seems more than likely that a good chunk of Black Widow's motivation for sacrificing herself to help save the world is so that her Red Room family gets to finally have the lives they have missed out on for so long. With this in mind, Black Widow's Endgame death ceases to be about Natasha Romanoff not having loved ones like the other Avengers, and instead becomes a testament to her love for her Red Room and Avengers family.
Similarly, it's not yet been entirely explained how the Black Widows fared in their reintegration into society after spending countless years carrying out assassinations that no doubt left them the enemies of various governments - especially with it being hinted that many others were still stuck under brainwashing across the world. Natasha was seemingly trusted a huge amount in SHIELD, but she also had the added benefit of having turned on the Red Room and Dreykov, not merely becoming a free agent after he was killed and the Red Room destroyed. As such, it seems another potential motivation for Romanoff in Endgame will have been to help redeem the Black Widow name. With Natasha having given her life to protect others, it becomes far more likely the other Widows will be regarded without suspicion - or at least treated more kindly, as a result of one of their number sacrificing herself for the good of mankind.
While Black Widow's Avengers: Endgame death is still undeniably one of the saddest moments in the MCU, there's some solace to be taken in the fact that the Black Widow movie emphasizes that her last deed wasn't done out of a lifetime of solitude, but rather because of the strong ties she formed over her life with so many people, much in the same vein as Iron Man.