That's what we're taught in school but it's really backwards. They make loans that they think will be profitable and then figure out how to get the reserves needed to cover the balance sheet (either through issuing equity, drumming up more deposits, or borrowing in the overnight repo market).
https://www.investopedia.com/articles/investing/022416/why-b...
A good phrase to search for to learn more is "loans create deposits"