MariaDB thread_pool_size tuning I think the setting of thread_pool_size = 500  has been installed at my site with the wrong understanding of its application.

Our host server has only 40 CPUs.
Isn't this setting going to be counter-productive? 

However, it looks to me like we might benefit from setting it slightly higher than our CPU count. 

Am I correct in thinking that we should not set it (much) higher than our CPU count, and never higher than 128, the limit posed in the manual?
Yes, it is going to be counterproductive. You can set it slightly higher than CPU count, maybe 2*CPU count, but not 12.5*CPU count. You do not want 500 connection to execute at the same time, CPU-bound. you only want to use as many  CPUs as you got.