For anyone who has recently encountered this issue, according to this article from Microsoft System.Text.Json started supporting serialization of the derived classes since .NET7.
You can achieve this by adding attribute annotations to the main class
[JsonDerivedType(typeof(DerivedExtensionA))]
public abstract class Extension