You can check here for the explanation of tty (teletype)
But summing up, tty 1-6 are for CLI terminal and tty7 up for GUI.
Check also here why tty7 is for X
Regarding the relationship for:
- run-level 1 (single-user) you have only one tty
- run-level 3 (multi-user text mode) you have by default from 1 to 6 and permits several users.
- run-level 5 (multi-user graphical mode) on this level vt7 comes into play to allow you to have a GUI.
So, whenever you switch to run-level 3, you don't have the services that enable tty7. When you get back into run-level 5 the service that creates tty7 will start, hence you are back to tty7.
This is the default, of course that you can change the settings.
Nowadays and if the distro you are using has systemd, the tty are dynamically generated but if you want to force you can edit
/etc/systemd/logind.conf and change the parameter