Are there countries that bar nationals from traveling to certain countries? (Reverse travel-ban)

I know that a travel ban based on nationality is normally enforced at the destination. It is most notable that Israelis suffer this kind of ban from most of the Arabic world.

Another notable examples are North and South Korea, which are reciprocal enemies and do not accept nationals of either nationality. It’s also extremely difficult to actually get a passport for North Koreans.

And of course US travel bans issued by Mr. Trump against nationals of certain Muslim countries.

But I wanted to ask about the opposite, mostly for sake of curiosity. Are there countries that forbid their own nationals to visit certain enemy states despite that destination state accepting them?

Example. National of country A can legally enter state B (from B’s laws point of view, and most likely using a connecting flight), but when that person returns to the home country A they get prosecuted by law, e.g. if they have passport stamps, pocket money from B or just any other evidence to have visited that state.

From the first example: an Israeli dual-national is likely to be able to visit Lybia with a second passport, but I don’t know, never heard, about any Israeli law prohibiting individuals to visit Lybia (should the government ever find out).