Hi, @FoolishResearcher,
Good news: this isn't a bug, just a slight misunderstanding 
First, I'd like to explain why the error doesn't occur when you uncomment the ## lines: as you know, these lines create the data frame and then save it to a file; however, prior to creating the data frame, the objects AB, B, and C, are all created within the scope of the server function. Therefore, the switch() call in your tab_input1 reactive expression is able to locate the objects AB and B. Thus, it is not the act of saving the data frame to the file before loading it that resolves the error, but rather the assignment of the AB and B variables that does.
The line commented out with #### is very close to resolving the error, but the switch statement must also be updated in order to completely fix it, as so:
switch(input$y_axis1,
"a or" = "AB",
"b" = "B")
The reason being that if you simply return AB or B, you are returning the object, and then attempting to use it to subset the data frame. However, as you have experienced, the objects AB and B do not exist if you only load the data frame from the file. Instead, by returning the name of the column in the data frame, it can be properly used to retrieve the data.
To make things a bit clearer, you can leave your renderPlotly() call unchanged (and remove the #### line) by fixing your switch() call, like so:
switch(input$y_axis1,
"a or" = testing_df[, "AB"],
"b" = testing_df[, "B"])
Again, the reason you must do this is that, when you load the object from the test.rds file, you are only loading in the data frame that was saved in it (i.e. my_df; this is because saveRDS() only saves a single R object to a file), and not the variables that were used to create it. Thus, in order to get the data you want, you must extract it from the data frame.
Hope this helps clears things up a bit!