I thought this was straightforward i.e. put the command that works in the buffer viz "set ts=4" in vimrc but this does not seem to work if I also want the functionality provided by vimrc_example, which I do.
I started with a fresh install of Vim 8.1 and added "set ts=4" to the end. When I fired up Vim, tabstop was set to 8. I looked more carefully at what vimrc does and found that there are all sorts of complicated things going on, including instructions that prevent subsequent instructions having any effect - aha!
I made a new vimrc that contains the one instruction "set ts=4" and found that works in the sense that tabstop is 4 when I run Vim. But of course there is none of the functionality that I want and expect from Vim e.g. syntax highlighting, so I tried what I thought was a minimal way of getting from something that worked to what I want. I made a vimrc that reads, in its entirety:
source $VIMRUNTIME/vimrc_example.vim set ts=4
This provides syntax highlighting etc but tabs are back at 8.
Digging a bit deeper, vimrc_example.vim calls defaults.vim and if I take that call out then tabs are set at 4 so the problem seems to be with defaults.vim. I had a look at defaults.vim and there are no occurrences of "set tabstop" or "set ts" or any mention of tabs so I am mystified. In desperation I stuck "set ts=4" on the end of defaults.vim and re-enabled the call to defaults.vim and that didn't work either.