Exactly, if was part of the sea, there would be no need for locks.
“Each vessel requires 200 million litres of freshwater to move through the canal’s locks.”
https://www.euronews.com/green/2023/08/25/panama-canal-drought-causes-shipping-backlog-amid-christmas-rush