Numpy Ufunc and dot overrides (continued from gh-2732)

Continuation of gh-2732, which additional bug fixes required to make things work as in ndarrays.

The fixes are not easily separated to a separate PR, as testing them goes through the `__numpy_ufunc__` support.