How to set class property's value to be set to generated id value of another class on insertion to database?

It's possible, but with some trickery which works with the latest at this time EF Core 2.2, and might stop working in 3.0+ (at least needs to be verified).

First, it has to be mapped as relationship - there is just no other way. It doesn't need to be a real database relationship though, just should be such from the EF Core model point of view.

Second, and this is quite important, the delete cascade behavior should be set to Restrict, which currently means enforce in the database, but do nothing with the tracked related entities in memory.

So let's do that with you sample. Both aforementioned mappings require fluent configuration similar to this:

modelBuilder.Entity<ClassB>().OwnsOne(e => e.ClassA)
    .HasOne<ClassA>().WithMany() // (1)
    .OnDelete(DeleteBehavior.Restrict); // (2)

If you are using migrations, the generated migration would contain something like this:

protected override void Up(MigrationBuilder migrationBuilder)
{
    migrationBuilder.CreateTable(
        name: "ClassA",
        columns: table => new
        {
            ClassAId = table.Column<int>(nullable: false)
                .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
            Name = table.Column<string>(nullable: true)
        },
        constraints: table =>
        {
            table.PrimaryKey("PK_ClassA", x => x.ClassAId);
        });

    migrationBuilder.CreateTable(
        name: "ClassB",
        columns: table => new
        {
            ClassBId = table.Column<int>(nullable: false)
                .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
            Action = table.Column<string>(nullable: true),
            ClassA_ClassAId = table.Column<int>(nullable: false),
            ClassA_Name = table.Column<string>(nullable: true)
        },
        constraints: table =>
        {
            table.PrimaryKey("PK_ClassB", x => x.ClassBId);
            table.ForeignKey(
                name: "FK_ClassB_ClassA_ClassA_ClassAId",
                column: x => x.ClassA_ClassAId,
                principalTable: "ClassA",
                principalColumn: "ClassAId",
                onDelete: ReferentialAction.Restrict);
        });

    migrationBuilder.CreateIndex(
        name: "IX_ClassB_ClassA_ClassAId",
        table: "ClassB",
        column: "ClassA_ClassAId");
}

Manually edit it and remove the ForeignKey command (line) since you don't want a real FK. You could also remove the corresponding CreateIndex command, although it won't hurt.

And that's all. The only important thing you need to remember is to use the principal TableAId property only after the new entity has been added to (thus tracked by) the context. i.e.

var testContext = new TestContext();
var classA = new ClassA
{
    Name = "classAName"
};
testContext.ClassAs.Add(classA); // <--
var classB = new ClassB
{
    Action = "create",
    ClassA = new ClassAOwned
    {
        ClassAId = classA.ClassAId, // <--
        Name = classA.Name
    }
};
testContext.ClassBs.Add(classB);
testContext.SaveChanges();

It will have generated temporary negative value, but after SaveChanged both ids will be updated with the actual database generated value.