It should not hurt the phone to remove the battery while the phone is on. In fact, this procedure is used when software gets stuck.
The behavior of the phone lighting up for just a few seconds means that the battery is depleted. The battery system is designed so that the battery will always save a little juice to keep the clock going, etc. It is not completely dead, so it will try to boot and then shut down to conserve that residual power.
I think you just happen to need new batteries and have been coasting for a while.