Why does changing the value of streamlit selectbox cause the entire page to refresh each time?

Streamlit reruns the code from top to bottom if there are state changes or events triggered. It is what it is. Read the main concept of streamlit especially the data flow.

Fortunately, there is an upcoming streamlit version where we have the power to designate which function to rerun.