"use <table>" and setting session variable is order depending

When working on pull request:

I notice that changing the order of these two lines is significant:

tk.MustExec("use test")
tk.Session().GetSessionVars().EnableClusteredIndex = variable.ClusteredIndexDefModeOn

I’m curious why setting session variable is reset(?) if current table changes.