Setting the TERM variable or the terminal size in .bashrc leads to some issues in tmux. By default, TERM is "vt220" in DietPi while using UART. This is a possible workaround that can be added to .bashrc:
if [ $TERM = vt220 ]; then TERM=linux stty cols 100 rows 30 fi
This way TERM doesn't change if it was set by tmux (in my case it is "tmux-color256"). This can also be used to add lines that shouldn't be executed every time you open a new window in tmux.