Why does a new file come out as 644 and a new directory as 755? The umask decides, and you can change it.
Run umask to see yours. A common value is 0022. Its bits are cleared from the default modes: 666 for files and 777 for directories. So 022 gives 644 and 755. Try a stricter one in your current shell:
umask 027
touch a.txt
mkdir d
ls -ld a.txt d
Now the file is 640 and the directory 750: group can read, others get nothing. That suits a shared server where I do not want other users reading my files by default.
The caveats: the umask only applies to the current shell and its children, so put it in ~/.profile or ~/.bashrc to keep it. It does not change files that already exist. And new files never get execute from the umask, since 666 has no x to begin with.
It looks like trivia until you share a machine. The default is fine for a personal laptop, but on a server with several accounts I would tighten it.
Further reading: umask man page (POSIX), Bash manual: Bourne Shell Builtins, On this site: stat -c prints the permissions as numbers, On this site: deny Read(./.env) so Claude never opens your secrets