The ruling bucks a trend set by courts around Japan that had raised hopes for marriage equality.