It does optimize by removing unnecessary data from the block space yes. Witness data is instead stored outside of the block, but still bound by the same rules. Segwit also introduces the concept of measuring blocks in weight units. So witness data isn't actually calculated as data consuming the block space but is calculated in the total weight unit of the block. It is also important to note that witness data is also limited (4 million weight units per block)