We have! Thermoelectric generators that make electricity directly from heat exist, they’re just often not very good compared to the spinny wheel.
We even use them to make nuclear reactors with no moving parts, which I think is really neat. They’re used in places where maintenance or refueling is difficult or impossible, like space probes.
https://en.wikipedia.org/wiki/Radioisotope_thermoelectric_generator
Another important point is the flexibility of wind and solar. The minimum investment to get some power out of them is very low, and a park can start generating power before fully completed and can easily be scaled up or down in capacity during construction if estimates change.
Nuclear on the other hand is a huge up-front cost with little flexibility and no returns until completion, which could take a decade or more.
Even if it wasn’t more expensive, nuclear would still be financially risky. Many things can happen that effect power consumption and prices during the time it takes to build a nuclear plant. It can still be valuable for diversification though.