Why can't, for example, a smartphone camera have longer exposure times (like 10s or more), does it have some hardware limitations that would damage the phone, like, overheat the sensor or something like that? Or, is it just the software limitation..
It's just a limitation of the built-in camera software. There are several apps available to take long exposure photos with smartphones. Some articles on gear, apps, and techniques:
Scott's answer is not strictly correct, depending on your quality expectations.
First of all, yes, eventually the sensor would overheat and fail, in theory. But that would presumably take a much longer exposure than anyone is going to be making with a smartphone.
The more immediate problem is thermal noise. Every sensor, particularly those with smaller sensels/pixels such as a smartphone's, is limited by signal-to-noise ratio which is basically what percent of the data it's recording is actually the light its detecting as opposed to background noise from its own electronics. As a sensor heats up, thermal noise arises and shifts that ratio in the wrong directly, often rapidly (again, particularly for smaller sensels).
Typically, the maximum exposure time your camera/smartphone's software allows will be the point at which thermal noise will push the SNR to unacceptable levels, rather than the point at which your sensor will overheat and damage itself. Nonetheless, I would make absolutely sure those apps didn't void my smartphone's warranty before I used one of them.
If you're seriously interested in long-exposure photography, you probably need to consider a "real" camera. If you've mostly shot with smartphones you'll be astonished how much more detail and quality you'll see with a raw file from a large sensor (even Micro-4/3 but especially APS-C or FF35) versus the ultra-compressed JPEGs and tiny-tiny pixels of even the latest smartphones.