Where does Gnome keep track of window size to use when starting applications?

Solution 1:

Gnome does not keep track of window size or state when a program is running or is closed. The window size and state upon program start is controlled by the application itself. Some applications will remember their windows settings between launches, others won't. Some use gsettings to store window sizes, others use a text config file, others do not store that at all.

Gnome does not keep track of where windows are positioned. Instead, it (actually the window manager Mutter) determines the position based on some algorithm. By default, an algorithm is used, where windows are maximally placed on place that is still free, or stacked if no free desktop space is available. This behavior can be changed to center new windows by changing the setting "org.gnome.mutter center-new-windows", eventually using Gnome Tweaks which exposes that setting. Programs themselves also may or may not store coordinates of the windows and restore them when relaunched.

I am aware that this does not solve your current issue of the always maximized terminal, but it answers the question you asked, i.e., where these settings are stored.

Solution 2:

In the case of the gnome-terminal app, there is a setting for that in the user profile (preferences):

Gnome-terminal window
  > Hamburger menu button
    > Preferences
      > "Preferences" window > sidebar > current profile (marked by checkmark)
        > "Text" tab > "Text appearance" section
          > "Initial terminal size" form group

terminal preferences screenshot

Beyond this setting, it is also interesting whether the window shows up in the center of the screen, or or somewhat to the left, or entirely to the left... In the case of gnome-terminal, I don't know where that is regulated.

Impact by Gnome Tweaks

The Gnome Tweaks app offers a setting to start every window at the center of the screen:

> Tweaks app
  > "Windows" sidebar item
    > "Center New Windows" toggle

Digging in gsettings

If you install dconf-editor, you can find numerous cases where the window position is stored in specific apps' gsettings schema.

sudo apt install dconf-editor

Then use the app's search feature: window-position related settings seem to come under the names of window-position, window-state, and window-ratio. So an useful search term in dconf is just window-.