For every order, attach that customer's median order amount as an additional column — without collapsing the rows. Each customer who placed 3 orders contributes 3 rows to the output, all sharing the same median.
Sort by customer_id then order_id ascending.