So as we saw earlier the principle of maximum entropy is simply a principle that if we are looking at a sufficiently isolated system then our uncertainties multiply until we are effectively choosing one possibility uniformly at random from some “phase space” of possibilities. The meaning of “uniformly at random” is slightly suspect, as it requires us to specify what coördinates we use to describe phase space, but in general we take every Cartesian position-and-momentum coördinate pair and parcel it up into chunks of some size $h$, where once we start doing quantum mechanics we get rigorous about $h$ being Planck's constant due to the uncertainty principle, but in classical mechanics it is just some normalization constant.
The “phase space of possibilities” then is constrained by any conservation laws that we have, e.g. conservation of energy, and by other constraints like a fixed volume, or a fixed number of particles. Finally, other observables can identify one macroscopic state as distinct from some other macroscopic state: for example if we are watching two gases of different colors (say red and blue) mixing together into one homogeneous color, we might have some sort of observable “mixing length” (the length of the purple segment between them) which identifies a class of macroscopic states distinct from each other. One often needs to be careful to include some form of experimental uncertainty to get an authentic count of microstates in a macrostate, but one can also take limits as this uncertainty goes to zero. The principle of maximum entropy then dictates a “spontaneous” transition of our observables to a configuration which has the largest phase-space volume.
The sort of reasoning we are pursuing
Suppose that like our two-gases-of-different-colors mixing example, we have a bigger system that is comprised of two subsystems with variable energies. We then have an internal degree of freedom, $E_1$, with the total energy $E$ conserved and $E_2 = E - E_1.$ This is some observable degree of freedom. Now if these subsystems are otherwise isolated, then we can come up with their subsystem entropies $S_{1,2}$ if we were to disable their ability to share energy with each other, and we would find due to the multiplicative nature of multiplicity and the logarithm that the overall entropy is $$S(E, E_1) = S_1(E_1) + S_2(E - E_1).$$Now if we were to change $E_1$ we would find a change in the entropy, $$S(E, E_1 + \epsilon) = S_1(E_1) + S_1'(E_1)\epsilon + S_2(E - E_1) - S_2'(E - E_1) \epsilon.$$The total change from an increase of $E_1$ is thus given by multiplying that change by $S_1' - S_2',$ and this change will be positive and therefore entropically favored if $S_1' > S_2'.$ So $S_{1,2}'$ measure a sort of coldness, where energy spontaneously flows into a subsystem with larger $S'$ from a subsystem with smaller $S'$. Moreover thermal equilibrium will then happen when they both have the same $S'$ at which point entropy will not favor one or the other at all.
A subtlety
If you were to now combine two of those systems into a homogeneous whole, would $\left(\frac{\partial S}{\partial E}\right)_{E_1}$ be a correct definition of temperature?
It is probably eventually correct, since it is $S_2'$, but it is probably not instantaneously correct. In fact a system which is not in thermal equilibrium cannot be assigned just one authoritative temperature value. So for example let us couple the four subsystems linearly with temperatures (in some arbitrary units):
+--------+ +--------+ +--------+ +--------+
| 10 |---| 70 |===| 40 |---| 60 |
+--------+ +--------+ +--------+ +--------+
Here we see four boxes thermally connected in a line, the first subsystem is two boxes with temperatures 10 and 70, the second subsystem is two boxes with temperatures 40 and 60.
The left subsystem has in some sense temperature "40" since that is what it would come to if allowed to come to equilibrium, (10 + 70)/2. The right subsystem has in some sense temperature "50" as that would be (40 + 60)/2. So if we were to define temperature coherently in this fashion, surely energy would flow from hotter to colder, from right to left, correct?
Well, that is eventually correct but it is not immediately correct. Since the 70 is in thermal contact with the 40, heat will first flow from the left to the right. Only after some time will the heat flow back from the right to the left.
So you are correct to suspect some shenanigans. Temperature does not have an additive property where we can easily define the temperature of a whole if its parts have different temperatures.
This can be very easily seen by the equipartition theorem, which states that the world can be decomposed into various “degrees of freedom” and then measures the temperature of any degree of freedom as the average energy in that degree of freedom. If you have a bunch of degrees of freedom, you can only define the temperature if they all have the same average.
So let's suppose you want to analyze a harmonic oscillator that dissipates into a many other degrees of freedom: probably what you want to do is to model this as a system with two non-equilibrium degrees of freedom $x, p$, and those two do not have a well-defined temperature, in some sort of contact with a multitude of degrees of freedom which we collectively combine into one thermal “bath” at some well-specified temperature. And this combined system can then show you a dissipation from the energy sloshing back and forth from $x$ into $p$ and back into the bath, plus it can show you that $x$ and $p$ come to a nonzero equilibrium energy state where they have the same energy as the bath.