Topology, rigid cosymmetries and linearization instability in higher gauge theories