The scenario editor and the game’s interface doesn’t allow for direct customization of the UI elements like adding buttons from one tab to another. The arrow button you see in the builder/dock tab is part of the game’s hardcoded interface; and unfortunately, it can’t be moved or duplicated to other tabs like the castle tab.
However, depending on what you are trying to do, you could do something similar using the scenario editor’s triggers and conditions to simulate the effect of switching pages or tabs. This would involve creating custom units or buildings that act as buttons and using triggers to change the available technologies or units based on player interactions (i.e. selecting a Market or moving a unit to a location would then trigger a change in a variable which you could check and then use to modify what technologies are displayed in the castle).
The only other option to do what you are describing is to create your own custom mod to customize the UI to include new buttons or modify existing ones etc.
An easier way to go about this is to download an existing mod like
These mods combine several UI enhancements/improvements that might include features that allow for additional buttons or improved navigation, so you don’t have to reinvent the wheel.
At the very least, when you subscribe to the mod, it is downloaded to your computer, and you can view the files in your file explorer to get an idea of how a mod should be structured and utilized for your own purposes.