You can create databases via sql [1]. It's just that after you run the statement, you're still connected to the old database and you need to disconnect in order to connect to the new one.
[1]: https://www.postgresql.org/docs/current/sql-createdatabase.h...