Can I add an attribute to any new entity and not mess up undo/redo?

You would need to wrap the attribute assignment inside an undo operation, and specify a transparent argument so that your operation is appended to the previous operation.

See API: Sketchup::Model#start_operation()

  def add_attribute_to_entity( model, entity, value )
    #
    model.start_operation(@opname,true,false,true)
    ###
      entity.set_attribute( @dict, @key, value )
    ###
    model.commit_operation
    #
  end