Provided a user is authorized to access something, how can he execute a system call directly, like geteuid() - get effective user ID (it's just an example) from bash, how could I do it?
User-space kernel-space communication via system calls is done in terms of memory locations and machine registers. That's way below the abstraction level of shells, which operate mainly with text strings.
That said, in bash, you can use the https://github.com/taviso/ctypes.sh plugin to get through the text-string abstraction down to C-level granularity:
$ . ctypes.sh $ dlcall -r long geteuid long:1001
For this particular operation though, it would be much simpler, more idiomatic, and more efficient to simply use bash's magic
$ echo "$EUID" #effectively a cached geteuid call 1001
For other syscalls (listed in syscalls(2)), it is the same: use some program (or some builtin or some plugin) doing them. That program could be directly coded in assembler and would use
SYSENTER machine instruction to do the system call, or (and much more often) it would use your C standard library and use the function from
libc doing that syscall. Executables don't need to be obtained from C source (for example, busybox is coded in assembler, the Scheme bones compiler don't use any libc). However, your
libc is a cornerstone of your system.
System calls changing some changeable and inheritable property of processes should be shell builtins (like
cd for chdir(2),
ulimit for setrlimit(2), etc...), because you might want to change the property in the shell process itself (and inherited by future command processes started by the shell). So if
cd was a program it would only apply to the shell's child process running that program.
Notice that Unix shells are ordinary programs. There are many of them (e.g. zsh, fish, scsh, es, etc ....)... It is an interesting exercise to code your own shell (and that can be done simply, see sash for an example; look also this for hints on globbing). Read something about Linux programming. If you are not happy with
bash use another shell (perhaps changing your login shell using chsh(1)) or write your own one. Also, GNU bash is -like most other shells- free software. You can study its source code and improve it if you want to.