I think it's a worthwhile experiment. The wiring is dirt simple, and the batteries run in the same voltage range. A deep-cycle battery is not necessarily required. It would certainly be useful in a longer-term power outage for lights and laptops; but don't expect to run a refrigerator.

There's no reason why a small solar panel (up to 5 watts) can't be used as a trickle charger while connected to the UPS. But pre-charge the battery before connecting, and shut down the UPS before using a line-powered battery charger.

Be aware that some UPS units, APC in particular, will not fire up on the inverter side after the battery has discharged. They have to see line (grid) voltage.

Risk: this depends on where you plan to use it.

I would never put a setup like this in a house. If something goes wrong, you are liable. (And insurance will probably laugh at you if try to make a claim.)

However, for a small off-grid outbuilding, it would be less of a risk. The battery and inverter should both be outside, in separate, weather resistant, ventilated enclosures.

The primary danger is a short across the battery terminals or the wiring. There is a lot of energy in a larger battery -- enough to start a fire or damage the battery in a dangerous way.

If you decide to build it:
- use very heavy wire from the battery to the UPS, and as short a run as possible
- install a 12V fuse or circuit breaker right at the battery to protect against a short circuit
- double-check polarity
- use good mechanical connections, with lots of wire overlap; spring-loaded clips are a recipe for trouble
- heavily insulate all connections
- monitor closely for overheating and odd smells

Personally, I would only use a hotwired setup under direct supervision, and only for light loads.