How to combine shared lines?

I hope this doesn’t come off as a stupid question, but is there a way to have 2 objects to share a line to reduce cutting?

So my example is 2 equal squares lined up together, sharing an edge. How can I make sure that those two squares only do one pass on the shared line?

In the optimization settings:
image

I plan to add the option to remove them from the design as well, but this version doesn’t need to be undoable, so it was simpler to write.