What counts as a class spell? Spells that are on the class's spell list. What else counts as a class spell? Whatever the class says counts.
The Sorcerer's Spellcasting feature says that if another Sorcerer features gives you additional always prepared spells, those spells count as Sorcerer spells. Hey look, most of the subclasses have one of those. The Cleric's Spellcasting feature has the same clause for the same reason. As does the Warlock's Pact Magic.
The wording is nearly the same. "If another Warlock feature gives you spells that you always have prepared, those spells don't count against the number of spells you can prepare with this feature, but those spells otherwise count as Warlock spells for you." The operative clause is, "spells that you always have prepared".
That covers the standard subclass [Patron] Spells feature. Does it cover invocations too? Well... probably not, by the RAW. The wording on all the at-will spell invocations is "You can cast [Spell Name] without expending a spell slot." Nothing about having it always prepared and available to cast with your Pact Magic slots. What about Lessons of the First Ones for Magic Initiate? Again, probably not by the RAW. LotFO is a Warlock feature that grants an Origin Feat. What that feat does is its own business, the Warlock feature granted a feat, not spells.