First, make sure that the pam-modules package is installed. That makes the pam_umask module available. Then make sure that /etc/pam.d/common-session has a line of the form
session optional pam_umask.so
so that pam_umask is enabled.
Now, according to the pam_umask man page, the default umask is determined at login by checking each of the following places, in order:
A hard system-wide default set in /etc/pam.d/common-session. To set it this way, replace the line from that file mentioned above with this:
session optional pam_umask.so umask=002
An entry in an individual user's GECOS field in /etc/passwd overrides a soft system-wide default for that specific user. Create that entry using a command of the form:
chfn --other='umask=002' username
An line of the form UMASK=002 in /etc/default/login (you may need to create that file) sets a soft system-wide default.
The UMASK value from /etc/login.defs. That value is also used for something else (computing the permissions on the home directory of a new user that is being created; see the comments in /etc/login.defs for more details). So it is best to avoid relying on this for setting the default umask for regular logins, to keep things separate.
So in your case, you should configure this either in /etc/default/login if you want it to be possible to override the setting for individual users, or set it in /etc/pam.d/common-session as described above if you want it to be the same for all users.
Note that even with the hard default setting, users can still override the default umask manually by using the umask command at the shell prompt or in their .profile script.
Also note that the traditional Unix way to set this default is by adding a umask command to /etc/profile, and that would also still work. But it's not the recommended way to configure things like this on Ubuntu, because that is hard to manage reliably using scripts and GUIs.
Note, unfortunately this stopped working for any application which has been converted to launch via systemd --user.