MariaDB threads goes around 10K suddenly
Many things may be involved.

First, which of these are you talking about?  (And what values do you have?)

"Threads_cached": "5",      -- 1000 might be good for you
"Threads_connected": "10",
"Threads_created": "36404", -- divide by Uptime
"Threads_running": "4",     -- 20 is a 'large' value

"Max_used_connections": "238",
"max_connections": "400",   -- we may need to tune this to avoid the problem


How do you "load balance" the Slaves?  Assuming that the connections are normally quick, "round robin" is better than any sophisticated method.

You should consider adding another Slave -- Keep in mind that if you lose a Slave (crash, maintenance, hiccup, etc), you will be back down to 3, which seems has the problem.  Having 4 up-to-date slaves may make the problem much rarer.

The reason for throttling max_connections is to throw the problem back to the client, forcing it to pick another Slave.  (I assume you recover from connection error and try again?)

Please describe how the data comes in.  It sounds like sensor data that is pushed from remote sensors?  Is there anything that would cause it to "sync" -- that is everyone sends at the top of the minute?  If so, is there a way to stagger the pushes?

Do the remote sensors do the following?


connect to mysql
insert one row (please provide details and SHOW CREATE TABLE)
disconnect


?  If not, please describe it.

Is there any "connection pooling"?  You mentioned "maxscale"; are you using that?

What is the average number of connections over an hour (or day or whatever)?  As a first cut, I would set max_connections to twice that.

Please provide (1) RAM size, (2) SHOW VARIABLES, (3) SHOW GLOBAL STATUS after mysql has been running for a day.  This may give more insight into the problems.