You are thinking along the right lines. There are various ways to set the safety stock, but in this case the logic is something like what you said.
When you place an order at time $t$ (say, at the first "Place order" point in your figure), that order has to last you until the end of the lead time for your next order. The total demand during those $...
If your costs are linear, there is no need to introduce binary variables or big-M constraints here. Define three sets of nonnegative decision variables:
$I_t$ is the inventory at the end of period $t$
$P_t$ is the production in period $t$
$B_t$ is the unmet demand in period $t$
Let $d_t$ be the demand in period $t$. The inventory balance constraints are