I have created a model you can download here from my github repo.
Thats how it looks:

Where:
- r is the input raster
- NClasses is a numerical input greater 0 (the amount of classes you wish to have)
And:
- you need to set a dependency for "Reclassy by table", because "Raster layer statistics" needs to execute first
- you need to insert a rather complex expression to "Reclassify by table", see below

The Expression as explanation (uses different variables than in the actual model above, better to explain this way):
-- CREATE VARIABLES
with_variable('rmin',1,( -- Equals to result of Raster layer statistics MIN result
with_variable('rmax',100,( -- Equals to result of Raster layer statistics MAX result
with_variable('nclasses',10, -- Equals to model input NClasses
-- for copy paste into your own model, only copy below, and change variables
-- NEST ARRAYS
array_to_string(array_foreach(
-- ADD LOWER CLASS VALUES
array_remove_at(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@nclasses)
,@element
-- ADD UPPER CLASS VALUES
-- concat
||','||
-- array of upper classes
array_get(
array_filter(
array_foreach(
generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses)
,
array_get(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),
array_find(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@element)+1)
),@element is not null)
,
-- get the index of initial array to insert at this position
array_find(
array_remove_at(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@nclasses)
,@element))
-- ADD CATEGORY VALUES
-- concat
||','||
-- array of class values
array_get(generate_series(1,@nclasses),
-- get the index of initial array to insert at this position
array_find(
array_remove_at(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@nclasses)
,@element))
)) -- closing array nesting
-- for copy paste into your own model, only copy above, and change variables
))))) -- closing with variable
*Only tested in QGIS 3.16.1
Further explanation on the expression:
The expression basically consists of four parts:
- Nest the three arrays below together, to get one single array_to_string like:
lowerclass1value,upperclass1value,class1reclassvalue,lowerclass2value,upperclass2value,class2reclassvalue,...
- An array to get the lower borders for each class
- An array to get the upper borders for each class
- An array to get the new values for each new class
#1 is done by:
array_to_string(array_foreach(...),THE_THREE_ARRAYS)
just some complicated nesting, I cant really explain...
#2 is done by:
array_remove_at(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@nclasses),@element
Generating a series from raster min value to raster max value in steps by raster range devided by nclasses-1. This will result in n equal classes. Since we only want the lower borders, we remove the last entry (raster max) from the array. The last @element is for nesting.
#3 is done by:
array_filter(
array_foreach(
generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses)
,
array_get(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),
array_find(generate_series(@rmin,@rmax,(@rmax-@rmin)/@nclasses),@element)+1)
),@element is not null)
Generating a series from raster min value to raster max value in steps by raster range devided by nclasses-1. This will result in n equal classes. Since we only want the upper borders here, we remove the first entry (raster min) from the array.
#4 is done by:
generate_series(1,@nclasses)
To generate class values from 1 to the maximum of classes. Step 1.
Cant really explain better.... Maybe best to try out yourself and stitch the parts together.
Proof:

raster layer statistics
to read min and max andreclassify by table
tool. However, you'd need a quite complex expression for reclassification: an array such asarray(@minfirstclass,@maxfirstclass,@firstclassval,@minsecondclass,@maxsecondclass,@secondclassval,...)
. You can easily get the breaks with something likegenerate_series(@rmin,@rmax,(@rmax-@rmin)/9)
, but the hard part is to stitch the final array together...