You want exactly one row per customer (their latest order) using ROW_NUMBER. Why must the ROW_NUMBER call sit in a subquery/CTE rather than be filtered directly in WHERE?
SELECT * FROM orders
WHERE ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY created_at DESC) = 1;