It is not "unproductive" from the perspective of the economy, but it is "unproductive" (i.e. low-returning) from the perspective of shareholders. We would not expect to see share prices rising if corporate profits in aggregate are not rising (unless there is some financial engineering going on).
We would expect it under certain circumstances. One explanation could be falling interest rates. Lower rates on bonds incentivize investors to take on more risk (moving more money into equities) in order to still meet their return targets.
Or more directly into valuations: govt bond yields are a component of equity discount rates (discount rate = risk free rate + equity risk premium). Of course low bond yields should also mean a slow economy, and thus lower future cash flows. After all the risk free rate is approximately the nominal GDP growth. So I'm not sure how far should this argument go ...