I'm female and about to lose my dynasty
I've never tried it, but you can probably kill yourself pretty quickly by closing the castle gates and letting your court starve. This seems like the most straightforward option.
Check your uncle to see if he has any kids. I believe cousins are far enough apart to marry, so hopefully he'll have some kid of the opposite sex to yours. Unfortunately I believe your kid will be in your husband's court since you are married regularly to him, but if I'm mistaken you can try to marry him to your uncle's kid (or another kid of your dynasty).
While parents are not allowed to plot to assassinate their kids, they are allowed to plot to kidnap them, which gives the option upon kidnapping to kill them. Babies tend to have low intrigue and lukewarm opinion in the court, so usually it's easy to find enough plotters, possibly with a little grease, to get the score high enough for the event to fire quickly. This will make you cruel, and I believe can make you a kinslayer if you are identified as the plot leader, but this is not the end of the world, and actually helps you out in a way.
If your uncle has a claim on the throne, he may get made the leader of a faction to overthrow it. You can piss off more vassals to get them to join that faction, and then "reluctantly" acquiesce when they demand your abdication. This should keep your uncle as your heir even if you have a non-dynastic kid, although you end up losing some of your demense on death.
You should have the option to kill yourself if your character ever gets depressed. Having friends die causes depression, so you can try making friends of people you can make commanders to try to get them killed.
This is another "I don't remember if this quite how it works, but you could try it" things - if you have a bastard child that isn't acknowledged by the father, I'm pretty sure it stays in your dynasty. So, you could go for the seduction focus and hope for the best.
If you ever get a deadly sin trait, you can join the Satan worshipers (assuming you have Monks and Mystics). Rank 3 lets you "dark divorce" your husband (i.e. kill him), Rank 4 lets you sacrifice your children in exchange for a longer life.