Race condition setting config from testbench parameter

Without seeing all the code involved, it is difficult to see the cause of your problem. A better approach would be to set() the parameter into the config_db in the initial block. That is guaranteed to execute before any get() in your test environment.

module top;
  parameter A;
  initial begin
    uvm_config_db # (int) :: get (null, "", "ParamA", A);
end 

class basetest extends uvm_test;
   my_uvm_config  cfg_h;
 
   function void build_phase (phase);
       cfg_h = my_uvm_config :: type_id :: create ("cfg_h", this);
       uvm_config_db # (my_uvm_config) :: set (null, "*", "my_uvm_config", cfg_h);
       if ( !uvm_config_db #(int) :: get (null, "", "ParamA", cfg_h.a) )
            cfg_h.a = 5; // default value
    endfunction