Is "structure preserving" part of defining the morphisms in a category?

The notion of a "structure preserving map" is informal, and predates category theory. When you're studying a mathematical object, a natural question is "when are two objects basically the same? (i.e. have the same "structure", which depends on how the objects are defined), which leads immediately to the concept of an isomorphism -- e.g. one definition of two topological spaces being "the same" is having the same configuration of open sets, which leads to the idea of a homeomorphism; or we can say that two graphs are "the same" if they have the same vertices, connected by edges in the same way. It just happens that isomorphisms (and the weaker notion of homomorphism) tend to have recurring properties (for lots of classes of objects), in that e.g. they can be composed in particular ways. A category (and, in particular, morphisms) are just an abstraction of that idea, but there are lots of things that behave "like" structure preserving maps without *actually* being functions at all, or without being "structure preserving" in any obvious sense -- e.g. the category associated to any poset, where a morphism between objects x and y simply indicates that x <= y.

> And then in the category of vector spaces that I mentioned in the question, the morphisms need not preserve linearity right?

In the usual category of vector spaces over a given field, the morphisms are linear maps, yes. We could define another category where the objects are vector spaces and the morphisms are just set functions. This is a perfectly fine category, but the morphisms don't really "preserve" vector space structure.
Morphisms don't need to be 'structure preserving' in categories, just associative under composition etc. In some cases 'structure preserving' may not even have any meaning in the category!
The notion of "structure preserving" can be made precise in some contexts, by abstracting the notion of "set with structure". It can be done in different ways. For instance, since we are talking about category theory, a way is adopting Lawvere theories.

Say we are dealing with groups, then the fundamental idea is expressing the group axioms as commutative diagrams, and taking the "most general" category T having these commutative diagrams - called a Lawvere theory T of groups. More precisely, think of T as having "powers" 1, t, t\^2, t\^3, ... as objects (representing the cartesian products of sets), together with a "multiplication" morphism m : t\^2 -> t, an "inverse elements" morphism n : t -> t and a "unit" morphism e : 1 -> t satisfying the arrow formulation of group axioms.

Then a group can be interpreted as a product-preserving functor G : T -> Set, i.e. G(t\^n) = G(t)\^n, making G(t) into a group because G(m), G(n) and G(e) satisfy the arrow formulation of group axioms for G(t). It turns out that natural transformations between such functors G, F induce (and are induced) by set maps G(t) -> F(t) preserving the group structure.

This argument can be generalised for any Lawvere theory T: of rings, monoids, abelian groups, vector spaces (in this case we require the notion of multisorted Lawvere theory).

This is why the structure preserving maps fit with categorical composition: the very notion of structure preserving can be defined as morphisms of a category. However, structures can be defined in several ways, not included in the example above (e.g. fields cannot be described using Lawvere theories).
The notion of 'structure-preserving' doesn't form part of the definition of a category.  There are categories defined on same class  of objects, but a different notion of morphism (e.g. objects are sets, and arrows are functions / relations / bijections / partial functions / etc.).

Informally, 'structures' and 'structure-preserving maps' provide good examples of categories, but it's more that if our notion of 'structure-preserving map' doesn't define a category, we would consider it a bit suspect (with a few interesting & well-studied exceptions, such as conformal field theory).

Other examples of categories are different. Any group or monoid is a category (with only one object). Any poset is a category, with elements as objects, and arrows given by the order relation.  MacLane gives a 'formal' category of binary trees, with a single unique arrow between any two trees with the same number of leaves.

If you really wanted to formalize 'structure-preserving', you might notice that monoid homomorphisms are functors between single-object categories, group homomorphisms are inverse-preserving functors, etc.  This just pushes the problem up to the level of 'preserving categorical structures', which doesn't really help much!
As others pointed out, morphisms of a category are not necessarily *structure-preserving*. One example I particularly like is the category whose objects are positive integers and in which the morphisms from *n* to *m* are *m x n* matrices. Composition is by matrix multiplication and identity morphisms are the identity matrices.
I've been getting into category theory recently, and from what I understand, a category (more generally a metacategory) is just a directed graph with identity and composition arrows. The arrows themselves don't contain information until we move to a specific category like Grp. Then with this specific category we have specific information encoded into their arrows (in Grp they're homomorphisms which are the structure preserving maps). With this extra information we can then play with the diagrams of a category knowing that the arrows are structure preserving. However, we don't always need them to be structure preserving, cause they're just "arrows". There are categories where the arrows aren't structure preserving like "Groups" with a single object and there can be any number of arrows, they just all have to be invertible. This is just a model of a group in the language of category theory but the arrows are actually acting like the group objects and not homomorphisms. In Groups, I don't believe the diagrams to be of much use because we didn't explicitly encode any extra information into the arrows.
It's interesting to note that while "structure (of objects)" and "(morphisms) preserving structure" is not part of the definition of a category, the morphisms of a category (and their composition) impose a kind of structure on its objects. What I mean by this is that, if I have a structure (say a group, or a graph) *G*, you can determine the structure of *G* (i.e. its elements and group multiplication, or its vertices and edges, up to relabelling of elements or vertices) by looking only at the morphisms involving *G* (i.e. the morphisms *G*->*X* for all *X*, or vice versa). (Note that this does not fix any particular *kind* of structure— it doesn't tell you whether *G* is a group in the first place.) This is a face of the Yoneda lemma.

For this reason, you could (if you were so inclined) introduce the morphisms of some category into the definition of "structure" and "structure-preserving", rather than the other way around. In this case, the definition of a linear map between *K*-vector spaces would simply become "a morphism in the category *K*-**Vect**", so that the standard definition of this structure becomes a mere tool to construct the category *K*-**Vect**. This idea is at least a little more appealing in the case of topological spaces, where there are many equivalent definitions of a topological space and continuous map, all of which really *do* seem like mere tools to define "continuity". The ultimate conclusion would then be to declare that all categories correspond to some structure, which may or may not be able to be restated more traditionally in terms of *sets* with added structure and structure-preserving *functions*.
In categories, there *is no structure* to preserve. Objects of a category as far as category theory is concerned, are essentially decided by their relations to other objects *through* morphisms.
Baffled no one is saying that _homomorphisms_ mean structure preserving, and _morphisms_ mean arrows in a category. They are two different things.
Folklore rule of thumb time: Let C be a category of "objects" and S: C^op x C -> Cat describe the "structure". Then the category of "object with structure" can be taken to be universal diagrams of the 'co-end'^[1] of S, i.e. with objects: an object c : C + structure s : S(c, c); and morphisms (c, s) -> (d, t) are taken as: a morphism m: c -> d + a morphism [in S(c, d)] S(c, m)(s) -> S(m, d)(t).

Example: A group is a set (g : Set), with structure S(g^op , g) = { (eps : g) x (mult : g^op -> g^op -> g) | group laws } [thought of as a discrete category]. Then a "group morphism" between ( g, eps^g , mult^g ) and ( h , eps^h , mult^h ) is a morphism (f : g -> h) and equalities [due to thinking of S(. , .) as a discrete cat]: f( eps^g ) = eps^h and \forall x, y: g. f( mult^g (x, y) ) = mult^h ( f(x), f(y) ). Exactly as we'd expect.

[1]: existence of that co-end is a bit questionable in general. Since S maps into Cat, not Set, this assumes enriched category theory and a bunch of things about the sizes of the cats involved.

Related questions

0 like 0 dislike
Importance of the role of First Order Logic (FOL) in understanding higher level mathematics
0 like 0 dislike
Is anyone familiar with the book, “Topics in the Theory of Numbers,” by Erdős and Surányi?
0 like 0 dislike
Differential Forms and Integration - Terence Tao. This is a masterful presentation on the topic and his explanations are as clear as any I’ve ever read in either book o...
0 like 0 dislike
Several issues of the Mathematische Schülerbücherei in pdf format. (great series from the former GDR)
0 like 0 dislike